/** * Returns an iterable yielding a bidirectional iterator that will be * {@linkplain FastSortedEntrySet fast}, if possible, on the * {@linkplain Map#entrySet() entry set} of the provided {@code map}. * * @param map * a map from which we will try to extract an iterable yielding a * (fast) bidirectional iterator on the entry set. * @return an iterable yielding a bidirectional iterator on the entry set of the * given map that will be fast, if possible. * @since 8.0.0 */ @SuppressWarnings("unchecked") public static <V> ObjectBidirectionalIterable<Int2ObjectMap.Entry<V>> fastIterable(Int2ObjectSortedMap<V> map) { final ObjectSortedSet<Int2ObjectMap.Entry<V>> entries = map.int2ObjectEntrySet(); return entries instanceof Int2ObjectSortedMap.FastSortedEntrySet ? ((Int2ObjectSortedMap.FastSortedEntrySet<V>) entries)::fastIterator : entries; } /**
/** * Returns a sorted-set view of the mappings contained in this map. * <p> * Note that this specification strengthens the one given in the corresponding * type-specific unsorted map. * * @return a sorted-set view of the mappings contained in this map. * @see SortedMap#entrySet() * @deprecated Please use the corresponding type-specific method instead. */ @SuppressWarnings({"unchecked", "rawtypes"}) @Deprecated @Override default ObjectSortedSet<Map.Entry<Integer, V>> entrySet() { return (ObjectSortedSet) int2ObjectEntrySet(); } /**
@Override public ObjectSortedSet<Int2ObjectMap.Entry<V>> int2ObjectEntrySet() { if (entries == null) entries = ObjectSortedSets.unmodifiable(sortedMap.int2ObjectEntrySet()); return (ObjectSortedSet<Int2ObjectMap.Entry<V>>) entries; } /**
@Override public ObjectSortedSet<Int2ObjectMap.Entry<V>> int2ObjectEntrySet() { if (entries == null) entries = ObjectSortedSets.synchronize(sortedMap.int2ObjectEntrySet(), sync); return (ObjectSortedSet<Int2ObjectMap.Entry<V>>) entries; } /**
/** * Returns a bidirectional iterator that will be {@linkplain FastSortedEntrySet * fast}, if possible, on the {@linkplain Map#entrySet() entry set} of the * provided {@code map}. * * @param map * a map from which we will try to extract a (fast) bidirectional * iterator on the entry set. * @return a bidirectional iterator on the entry set of the given map that will * be fast, if possible. * @since 8.0.0 */ @SuppressWarnings("unchecked") public static <V> ObjectBidirectionalIterator<Int2ObjectMap.Entry<V>> fastIterator(Int2ObjectSortedMap<V> map) { final ObjectSortedSet<Int2ObjectMap.Entry<V>> entries = map.int2ObjectEntrySet(); return entries instanceof Int2ObjectSortedMap.FastSortedEntrySet ? ((Int2ObjectSortedMap.FastSortedEntrySet<V>) entries).fastIterator() : entries.iterator(); } /**