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 7639321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:23:20+00:00 2026-05-31T08:23:20+00:00

I have a guava HashMultimap like this Multimap<String, String> multiMap = HashMultimap.create(); multiMap.put(a, x);

  • 0

I have a guava HashMultimap like this

Multimap<String, String> multiMap = HashMultimap.create();
multiMap.put("a", "x");
multiMap.put("a", "y");
multiMap.put("b", "y");
multiMap.put("b", "z");
multiMap.put("d", "x");
multiMap.put("c", "h");

and I want to create a table with the distinct key and values. Calling

multiMap.values(); // returns x,y,y,z,x,h

but I want to the distinct set of values?.

I’m aware that Iterator.filter() is available but am unsure how it should be implmented. The expected result should be

// x,y,z,h
  • 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-31T08:23:22+00:00Added an answer on May 31, 2026 at 8:23 am

    I’d just use

    Sets.newHashSet(multiMap.values());
    

    or, if you want an immutable version:

    ImmutableSet.copyOf(multiMap.values());
    

    Note that in either case you no longer have a live view of the values but a copy.

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

Sidebar

Related Questions

why does Guava doesn't have the following factory call to create a MultiMap from
I have to store more than 100 millions of key-values in my HashMultiMap (key
Using Guava, I would like to have a map that has the following properties:
I have a project which would like to utilize the Google Guava libraries (on
We have a List of items: List<X> from this List, we would like to
I'm using Google Guava r08 and JDK 1.6.0_23. I want to create an ImmutableSortedMap
I would like to have a c.g.c.c.Multimap that is sorted based on keys only.
I have here a number of checkboxes. just like this: <div id = 'fCheck'>
I have an string array {ted, williams, golden, voice, radio} and I want all
I have situation where I want to extract multiple values from multiple source objects

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.