/** * 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<Byte2ObjectMap.Entry<V>> fastIterable(Byte2ObjectSortedMap<V> map) { final ObjectSortedSet<Byte2ObjectMap.Entry<V>> entries = map.byte2ObjectEntrySet(); return entries instanceof Byte2ObjectSortedMap.FastSortedEntrySet ? ((Byte2ObjectSortedMap.FastSortedEntrySet<V>) entries)::fastIterator : entries; } /**
@Override public ByteComparator comparator() { synchronized (sync) { return sortedMap.comparator(); } } @Override
@Override public byte firstByteKey() { synchronized (sync) { return sortedMap.firstByteKey(); } } @Override
/** * {@inheritDoc} * <p> * Note that this specification strengthens the one given in * {@link SortedMap#subMap(Object,Object)}. * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override default Byte2ObjectSortedMap<V> subMap(final Byte from, final Byte to) { return subMap((from).byteValue(), (to).byteValue()); } /**
/** * {@inheritDoc} * <p> * Note that this specification strengthens the one given in * {@link SortedMap#tailMap(Object)}. * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override default Byte2ObjectSortedMap<V> tailMap(final Byte from) { return tailMap((from).byteValue()); } /**
/** * {@inheritDoc} * <p> * Note that this specification strengthens the one given in * {@link SortedMap#headMap(Object)}. * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override default Byte2ObjectSortedMap<V> headMap(final Byte to) { return headMap((to).byteValue()); } /**
@Override public byte lastByteKey() { synchronized (sync) { return sortedMap.lastByteKey(); } } /**
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override public Byte lastKey() { return sortedMap.lastKey(); } /**
@Override public ByteSortedSet keySet() { if (keys == null) keys = ByteSortedSets.unmodifiable(sortedMap.keySet()); return (ByteSortedSet) keys; } @Override
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override public Byte firstKey() { return sortedMap.firstKey(); } /**
@Override public Byte2ObjectSortedMap<V> subMap(final byte from, final byte to) { return new SynchronizedSortedMap<>(sortedMap.subMap(from, to), sync); } @Override
@Override public Byte2ObjectSortedMap<V> tailMap(final byte from) { return new SynchronizedSortedMap<>(sortedMap.tailMap(from), sync); } @Override
@Override public Byte2ObjectSortedMap<V> headMap(final byte to) { return new UnmodifiableSortedMap<>(sortedMap.headMap(to)); } @Override
@Override public byte lastByteKey() { return sortedMap.lastByteKey(); } /**
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override public Byte lastKey() { synchronized (sync) { return sortedMap.lastKey(); } } /**
@Override public ByteSortedSet keySet() { if (keys == null) keys = ByteSortedSets.synchronize(sortedMap.keySet(), sync); return (ByteSortedSet) keys; } @Override
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override public Byte firstKey() { synchronized (sync) { return sortedMap.firstKey(); } } /**
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override public Byte2ObjectSortedMap<V> subMap(final Byte from, final Byte to) { return new SynchronizedSortedMap<>(sortedMap.subMap(from, to), sync); } /**
@Override public Byte2ObjectSortedMap<V> tailMap(final byte from) { return new UnmodifiableSortedMap<>(sortedMap.tailMap(from)); } @Override
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override public Byte2ObjectSortedMap<V> headMap(final Byte to) { return new UnmodifiableSortedMap<>(sortedMap.headMap(to)); } /**