Set
is for uniqueness, although there is nothing for key -> value
thing in Set
collections. So,
HashSet<Integer,Integer>
does not exists at all.
Probably Map
is what you're looking for, as soon as you have a unique Integer to use as key.
Example:
Map<Integer, Integer> map = new HashMap<>();
map.put(118, 15); //the key is 118, value is 15
map.put(429, 15);
map.put(625, 30);
map.get(118); //get the value for the key 118, so it returns 15
It you can't guarantee the uniqueness of any of Integer
s, you probably can use:
List<Integer[]> ints = new ArrayList<>();
ints.add(new Integer[] {185, 15});
ints.add(new Integer[] {429, 15});
ints.add(new Integer[] {625, 15});
EDIT
As you explained through review, the first element is unique, so you're probably ok with the Map
interface, as it is the main purpose of it.