Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 760951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:46:46+00:00 2026-05-14T15:46:46+00:00

This question is a continuation of this thread : In short: To solve my

  • 0

This question is a continuation of this thread:

In short: To solve my problem, I want to use Map<Set<String>, String>.

However, after I sort my data entries in Excel, remove the unnecessary parameters, and the following came out:

flow content ==> content content 
flow content ==> content depth distance 
flow content ==> content depth within 
flow content ==> content depth within distance 
flow content ==> content within 
flow content ==> content within distance 

I have more than one unique key for the hashmap if that is the case. How do I go around this… anyone have any idea?

I was thinking of maybe Map<Set <String>, List <String>> so that I can do something like:

Set <flow content>, List <'content content','content depth distance','content depth within ', ..., 'content within distance'>

But because I am parsing the entries line by line I can’t figure out the way how to store values of the same repeated keys (flow content) into the same list and add it to the map.

Anyone have a rough logic on how can this be done in Java?

Thanks in advance.

–EDIT:

Trying Multimap but somehow have slight problem:

public static void main(String[] args) {

    File file = new File("apriori.txt");
    Multimap<Set <String>, String> mm = HashMultimap.create();
    Set<String> s = null;
    List l = null;

    BufferedReader br = null;

    try {
            br = new BufferedReader(new FileReader(file));
            String line = "";

            while ((line = br.readLine()) != null) {
                //Regex delete only tokenize

                String[] string = line.split(";");
                System.out.println(string[0] + " " + string[1]);

                StringTokenizer st = new StringTokenizer(string[0].trim());
                while (st.hasMoreTokens()) {
                    //System.out.println(st.nextToken());
                    s = new HashSet<String>();
                    s.add(st.nextToken());
                }
                mm.put(s,string[1]);
            }

        // dispose all the resources after using them.
        br.close();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    Set<String> t = new HashSet<String>();
    t.add("content");
    t.add("by");

    String str = mm.get(t).toString();
    System.out.println(str);

    for (Map.Entry<Set <String>, String> e : mm.entries()) {
        System.out.println(e);
    }
}

The apriori.txt

byte_jump ; msg 
byte_jump ; msg by 
content ; msg 
content by ; flow 
content by ; msg 
content by ; msg flow 
content by byte_jump ; msg 
content byte_jump ; by 
content byte_jump ; msg 
content byte_jump ; msg by

Apparently the output for the forloop:

[content]= msg 
[by]= flow 
[by]= msg 
[by]= msg flow 
[byte_jump]= msg 
[byte_jump]= by 
[byte_jump]= msg by 

instead of [content by]= msg flow

Why is that so? I tried and it works. But I need Set to compare the strings regardless of position. What can I do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:46:47+00:00Added an answer on May 14, 2026 at 3:46 pm

    A multimap allows multiple values for a specific key.

    One implementation is the various Multimaps which are provided as part of Google Collections.

    Rather than coding a way to correctly store data into a Map<String, List<String>, it would probably be a better choice to go ahead and use the appropriate data structure for the job.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is in continuation to my existing thread . Below given is a
This is a continuation question from a previous question I have asked I now
This is a continuation of my question about reading the superblock . Let's say
This is in continuation with the question posted here: Finding the center of mass
This is a continuation of the question posted in: How to load a jar
This thread is a continuation of Is there a reason to check for null
This question is in continuation to Is there a decent tool for automatically cleaning
This question is in continuation of this post , I have tried installing Xerces-C
This question is in continuation to my previous post located here . Since there
This question is in continuation of this one . The deal is simple. Given:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.