private MapDelegatingSet<Entry<Long, Long>> entrySetSingleton() { return new MapDelegatingSet<Entry<Long, Long>>(this, new EntryIteratorSupplier(new EntryIterator()), new Predicate() { @SuppressWarnings("unchecked") @Override public boolean test(Object e) { return containsKey(((Entry<Long, Long>) e).getKey()); } }); }
private MapDelegatingSet<Long> keySetSingleton() { return new MapDelegatingSet<Long>(this, new IteratorSupplier(new LongIterator(0)), new Predicate() { @Override public boolean test(Object value) { return containsValue(value); } }); }
private Long2LongHashMap(double loadFactor, long missingValue) { this.entrySet = entrySetSingleton(); this.keySet = keySetSingleton(); this.values = valuesSingleton(); this.valueIterator = new LongIterator(1); this.loadFactor = loadFactor; this.missingValue = missingValue; }
/** * Remove a value from the map and return the value. * * @param keyPartA for the key * @param keyPartB for the key * @return the previous value if found otherwise null */ public V remove(final int keyPartA, final int keyPartB) { final long key = compoundKey(keyPartA, keyPartB); return map.remove(key); }
/** * Retrieve a value from the map. * * @param keyPartA for the key * @param keyPartB for the key * @return value matching the key if found or null if not found. */ public V get(final int keyPartA, final int keyPartB) { final long key = compoundKey(keyPartA, keyPartB); return map.get(key); }
public long get(final long key) { final long[] entries = this.entries; int index = evenLongHash(key, mask); long candidateKey; while ((candidateKey = entries[index]) != missingValue) { if (candidateKey == key) { return entries[index + 1]; } index = next(index); } return missingValue; }
/** * Put a value into the map. * * @param keyPartA for the key * @param keyPartB for the key * @param value to put into the map * @return the previous value if found otherwise null */ public V put(final int keyPartA, final int keyPartB, final V value) { final long key = compoundKey(keyPartA, keyPartB); return map.put(key, value); }
private Long2LongHashMap(double loadFactor, long missingValue) { this.entrySet = entrySetSingleton(); this.keySet = keySetSingleton(); this.values = valuesSingleton(); this.valueIterator = new LongIterator(1); this.loadFactor = loadFactor; this.missingValue = missingValue; }
private MapDelegatingSet<Entry<Long, Long>> entrySetSingleton() { return new MapDelegatingSet<Entry<Long, Long>>(this, new EntryIteratorSupplier(new EntryIterator()), new Predicate() { @SuppressWarnings("unchecked") @Override public boolean test(Object e) { return containsKey(((Entry<Long, Long>) e).getKey()); } }); }
private MapDelegatingSet<Long> keySetSingleton() { return new MapDelegatingSet<Long>(this, new IteratorSupplier(new LongIterator(0)), new Predicate() { @Override public boolean test(Object value) { return containsValue(value); } }); }
/** * Remove a value from the map and return the value. * * @param keyPartA for the key * @param keyPartB for the key * @return the previous value if found otherwise null */ public V remove(final int keyPartA, final int keyPartB) { final long key = compoundKey(keyPartA, keyPartB); return map.remove(key); }
/** * Retrieve a value from the map. * * @param keyPartA for the key * @param keyPartB for the key * @return value matching the key if found or null if not found. */ public V get(final int keyPartA, final int keyPartB) { final long key = compoundKey(keyPartA, keyPartB); return map.get(key); }
public long get(final long key) { final long[] entries = this.entries; int index = evenLongHash(key, mask); long candidateKey; while ((candidateKey = entries[index]) != missingValue) { if (candidateKey == key) { return entries[index + 1]; } index = next(index); } return missingValue; }