org.jhotdraw8.icollection.facade.ReadOnlyCollectionFacade Maven / Gradle / Ivy
/*
* @(#)ReadOnlyCollectionFacade.java
* Copyright © 2023 The authors and contributors of JHotDraw. MIT License.
*/
package org.jhotdraw8.icollection.facade;
import org.jhotdraw8.icollection.impl.iteration.IteratorSpliterator;
import org.jhotdraw8.icollection.readonly.AbstractReadOnlyCollection;
import org.jhotdraw8.icollection.readonly.ReadOnlyCollection;
import org.jhotdraw8.icollection.readonly.ReadOnlySet;
import org.jspecify.annotations.Nullable;
import java.util.Collection;
import java.util.Iterator;
import java.util.Spliterator;
import java.util.function.IntSupplier;
import java.util.function.Predicate;
import java.util.function.Supplier;
/**
* Provides a {@link ReadOnlyCollection} facade to a set of {@code Collection} functions.
*
* @param the element type
* @author Werner Randelshofer
*/
public class ReadOnlyCollectionFacade extends AbstractReadOnlyCollection {
protected final Supplier> iteratorFunction;
protected final IntSupplier sizeFunction;
protected final Predicate