About 432,000 results
Open links in new tab
  1. data structures - How to create a 2 way map in java - Stack Overflow

    Aug 7, 2010 · The BiMap.inverse method appears to return a Map with the values as the keys, and the keys as the values, so that Map can be used to call get on the value and retrieve a key. In addition the Map returned by inverse is a view of the underlying data, so it does not have to make extra copies of the original data. From the BiMap.inverse method ...

  2. What is the difference between a map and a dictionary?

    Mar 13, 2018 · Many map implementations enforce uniqueness of the keys and only allow each key to be associated with one value, but that value might be able to be a data structure itself containing many values of a simpler data type, e.g. { {1,{"one", "ichi"}, {2, {"two", "ni"}} } illustrates values consisting of pairs/sets of strings.

  3. java - Map of Maps data structure - Stack Overflow

    Dec 4, 2015 · The MultiValueMap class (Apache commons collections) makes it easy to work with a Map whose values are Collections. I'm looking for a a class that makes it easy to work with a Map whose keys are objects and values are Maps. I'm using Java 1.4, so can't use Google Collections or generics.

  4. java - JSON Representation of Map with Complex Key - Stack …

    Jun 6, 2012 · JSON requires the key to be a string, so if you truly need the data to be represented as keyed (e.g. you don't want to use an array, like in Pointy's answer, because you'd like to guarantee it in the contract that there are no duplicate entries with the same key) then you'd need to decide yourself on a way to serialize the complex key into a string.

  5. java - Difference between a HashMap and a dictionary ADT - Stack …

    Sep 17, 2015 · Map is an interface for an ADT in Java, the same general language-independent data structure for maintaining <key, value> pairs, and is introduced in Java 1.2. Dictionary (not an implementation of Map) is an Abstract class for the same purpose introduced earlier in JDK 1.0. The only subclass it has is Hashtable which itself is implementing Map.

  6. Implementing a one to many map in Java - Stack Overflow

    May 15, 2011 · You could have a Map of type A objects to a List or Set (or whichever Collection works best) of type B objects, like: Map<A,List<B>> map = new HashMap<A,List<B>>(); Or use Google's MultiMap interface, which will do essentially …

  7. java - Understanding TreeMaps - Stack Overflow

    The TreeMap is sorted according to the natural ordering of its keys. Tree Map will always have all elements sorted. Working of Tree Map is based on tree data structure. Tree Map is not Synchronized and hence not thread safe. Tree Map in java doesn't allow null key,but allow multiple null values. Working of Tree Map is based on tree data structure.

  8. java - Map implementation with duplicate keys - Stack Overflow

    I want to have a map with duplicate keys. I know there are many map implementations (Eclipse shows me about 50), so I bet there must be one that allows this. I know it's easy to write your own map...

  9. java - How to implement a Map with multiple keys? - Stack Overflow

    May 5, 2009 · I need a data structure which behaves like a Map, but uses multiple (differently-typed) keys to access its values. (Let's not be too general, let's say two keys) Keys are guaranteed to be unique.

  10. java - 3-Dimension List or Map - Stack Overflow

    Jul 2, 2015 · 2) you want to associate the sirst string with the second-and-third data (and associate the second with the int): create a Map> and add the elements to it (you will have to create the inner map for each new first string) 3) you don't want to keep duplicates, but you don't want/need a map.: Create a custom type (a'la 1)) and put them in a Set ...

Refresh