@Override public boolean equals(final Object o) { if (!(o instanceof Map.Entry)) return false; if (o instanceof Float2IntMap.Entry) { final Float2IntMap.Entry e = (Float2IntMap.Entry) o; return (Float.floatToIntBits(key) == Float.floatToIntBits(e.getFloatKey())) && ((value) == (e.getIntValue())); } final Map.Entry<?, ?> e = (Map.Entry<?, ?>) o; final Object key = e.getKey(); if (key == null || !(key instanceof Float)) return false; final Object value = e.getValue(); if (value == null || !(value instanceof Integer)) return false; return (Float.floatToIntBits(this.key) == Float.floatToIntBits(((Float) (key)).floatValue())) && ((this.value) == (((Integer) (value)).intValue())); } @Override
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override default Integer setValue(final Integer value) { return Integer.valueOf(setValue((value).intValue())); } }
entries = new AbstractObjectSortedSet<Float2IntMap.Entry>() { final Comparator<? super Float2IntMap.Entry> comparator = (Comparator<Float2IntMap.Entry>) (x, y) -> Float2IntAVLTreeMap.this.actualComparator.compare(x.getFloatKey(), y.getFloatKey()); @Override public Comparator<? super Float2IntMap.Entry> comparator() {
entries = new AbstractObjectSortedSet<Float2IntMap.Entry>() { final Comparator<? super Float2IntMap.Entry> comparator = (Comparator<Float2IntMap.Entry>) (x, y) -> Float2IntRBTreeMap.this.actualComparator.compare(x.getFloatKey(), y.getFloatKey()); @Override public Comparator<? super Float2IntMap.Entry> comparator() {
/** {@inheritDoc} */ @SuppressWarnings({"unchecked", "deprecation"}) @Override public void putAll(final Map<? extends Float, ? extends Integer> m) { if (m instanceof Float2IntMap) { ObjectIterator<Float2IntMap.Entry> i = Float2IntMaps.fastIterator((Float2IntMap) m); while (i.hasNext()) { final Float2IntMap.Entry e = i.next(); put(e.getFloatKey(), e.getIntValue()); } } else { int n = m.size(); final Iterator<? extends Map.Entry<? extends Float, ? extends Integer>> i = m.entrySet().iterator(); Map.Entry<? extends Float, ? extends Integer> e; while (n-- != 0) { e = i.next(); put(e.getKey(), e.getValue()); } } } /**
@Override public String toString() { final StringBuilder s = new StringBuilder(); final ObjectIterator<Float2IntMap.Entry> i = Float2IntMaps.fastIterator(this); int n = size(); Float2IntMap.Entry e; boolean first = true; s.append("{"); while (n-- != 0) { if (first) first = false; else s.append(", "); e = i.next(); s.append(String.valueOf(e.getFloatKey())); s.append("=>"); s.append(String.valueOf(e.getIntValue())); } s.append("}"); return s.toString(); } }
@Override public boolean contains(final Object o) { if (!(o instanceof Map.Entry)) return false; if (o instanceof Float2IntMap.Entry) { final Float2IntMap.Entry e = (Float2IntMap.Entry) o; final float k = e.getFloatKey(); return map.containsKey(k) && ((map.get(k)) == (e.getIntValue())); } final Map.Entry<?, ?> e = (Map.Entry<?, ?>) o; final Object key = e.getKey(); if (key == null || !(key instanceof Float)) return false; final float k = ((Float) (key)).floatValue(); final Object value = e.getValue(); if (value == null || !(value instanceof Integer)) return false; return map.containsKey(k) && ((map.get(k)) == (((Integer) (value)).intValue())); }
@Override public void setData( int totalNumValues, float binSize, Float2IntMap... counts ) { totalHeights = new Float2IntOpenHashMap( ); totalHeights.defaultReturnValue( 0 ); for ( Float2IntMap countMap : counts ) { for ( Float2IntMap.Entry entry : countMap.float2IntEntrySet( ) ) { int sum = totalHeights.get( entry.getFloatKey( ) ); sum += entry.getIntValue( ); totalHeights.put( entry.getFloatKey( ), sum ); } } super.setData( totalNumValues, binSize, counts ); }
@Override public boolean remove(final Object o) { if (!(o instanceof Map.Entry)) return false; if (o instanceof Float2IntMap.Entry) { final Float2IntMap.Entry e = (Float2IntMap.Entry) o; return map.remove(e.getFloatKey(), e.getIntValue()); } Map.Entry<?, ?> e = (Map.Entry<?, ?>) o; final Object key = e.getKey(); if (key == null || !(key instanceof Float)) return false; final float k = ((Float) (key)).floatValue(); final Object value = e.getValue(); if (value == null || !(value instanceof Integer)) return false; final int v = ((Integer) (value)).intValue(); return map.remove(k, v); } @Override
/** * Returns a type-specific list iterator on the elements in this set, starting * from a given element of the set. Please see the class documentation for * implementation details. * * @param from * an element to start from. * @return a type-specific list iterator starting at the given element. * @throws IllegalArgumentException * if {@code from} does not belong to the set. */ @Override public ObjectListIterator<Float2IntMap.Entry> iterator(final Float2IntMap.Entry from) { return new EntryIterator(from.getFloatKey()); } /**
/** * Returns a type-specific fast list iterator on the elements in this set, * starting from a given element of the set. Please see the class documentation * for implementation details. * * @param from * an element to start from. * @return a type-specific list iterator starting at the given element. * @throws IllegalArgumentException * if {@code from} does not belong to the set. */ @Override public ObjectListIterator<Float2IntMap.Entry> fastIterator(final Float2IntMap.Entry from) { return new FastEntryIterator(from.getFloatKey()); } /** {@inheritDoc} */
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override default Integer getValue() { return Integer.valueOf(getIntValue()); } /**
@Override public int nextInt() { return i.next().getIntValue(); }; @Override
@Override public ObjectBidirectionalIterator<Float2IntMap.Entry> iterator(final Float2IntMap.Entry from) { return new SubmapEntryIterator(from.getFloatKey()); } @Override
@Override public ObjectSortedSet<Float2IntMap.Entry> subSet(Float2IntMap.Entry from, Float2IntMap.Entry to) { return subMap(from.getFloatKey(), to.getFloatKey()).float2IntEntrySet(); } @Override
@Override public ObjectSortedSet<Float2IntMap.Entry> tailSet(Float2IntMap.Entry from) { return tailMap(from.getFloatKey()).float2IntEntrySet(); } };
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override default Float getKey() { return Float.valueOf(getFloatKey()); } /**
@Override public ObjectSortedSet<Float2IntMap.Entry> headSet(Float2IntMap.Entry to) { return headMap(to.getFloatKey()).float2IntEntrySet(); } @Override
@Override public ObjectSortedSet<Float2IntMap.Entry> subSet(Float2IntMap.Entry from, Float2IntMap.Entry to) { return subMap(from.getFloatKey(), to.getFloatKey()).float2IntEntrySet(); } @Override
@Override public ObjectSortedSet<Float2IntMap.Entry> headSet(Float2IntMap.Entry to) { return headMap(to.getFloatKey()).float2IntEntrySet(); } @Override