![JAR search and dependency download from the Maven repository](/logo.png)
org.jhotdraw8.icollection.facade.ReadOnlySequencedMapFacade Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.jhotdraw8.icollection Show documentation
Show all versions of org.jhotdraw8.icollection Show documentation
JHotDraw8 Immutable Collections
The newest version!
/*
* @(#)ReadOnlySequencedMapFacade.java
* Copyright © 2023 The authors and contributors of JHotDraw. MIT License.
*/
package org.jhotdraw8.icollection.facade;
import org.jhotdraw8.icollection.readonly.ReadOnlySequencedMap;
import org.jspecify.annotations.Nullable;
import java.util.Comparator;
import java.util.Iterator;
import java.util.Map;
import java.util.SequencedMap;
import java.util.Spliterator;
import java.util.function.Function;
import java.util.function.IntSupplier;
import java.util.function.Predicate;
import java.util.function.Supplier;
/**
* Provides a {@link ReadOnlySequencedMap} facade to a set of {@code ReadOnlySequencedMap} functions.
*
* @param the key type
* @param the value type
* @author Werner Randelshofer
*/
public class ReadOnlySequencedMapFacade extends ReadOnlyMapFacade
implements ReadOnlySequencedMap {
private final Supplier> firstEntryFunction;
private final Supplier> lastEntryFunction;
private final Supplier>> reverseIteratorFunction;
private final int characteristics;
private final @Nullable Comparator super K> comparator;
public ReadOnlySequencedMapFacade(SequencedMap target) {
super(target);
this.firstEntryFunction = target::firstEntry;
this.lastEntryFunction = target::lastEntry;
this.reverseIteratorFunction = () -> target.reversed().sequencedEntrySet().iterator();
this.characteristics = Spliterator.ORDERED | Spliterator.SIZED | Spliterator.DISTINCT;
this.comparator = null;
}
public ReadOnlySequencedMapFacade(
Supplier>> iteratorFunction,
Supplier>> reverseIteratorFunction,
IntSupplier sizeFunction,
Predicate
© 2015 - 2025 Weber Informatics LLC | Privacy Policy