/*
 * Copyright (c) 2020 Goldman Sachs and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * and Eclipse Distribution License v. 1.0 which accompany this distribution.
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 * and the Eclipse Distribution License is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 */

package org.eclipse.collections.impl.stack.mutable.primitive;

import java.io.Serializable;
import java.util.Collection;

import org.eclipse.collections.api.FloatIterable;
import org.eclipse.collections.api.LazyFloatIterable;
import org.eclipse.collections.api.RichIterable;
import org.eclipse.collections.api.bag.primitive.MutableFloatBag;
import org.eclipse.collections.api.block.function.primitive.FloatIntToObjectFunction;
import org.eclipse.collections.api.block.function.primitive.FloatToObjectFunction;
import org.eclipse.collections.api.block.function.primitive.ObjectFloatToObjectFunction;
import org.eclipse.collections.api.block.function.primitive.ObjectFloatIntToObjectFunction;
import org.eclipse.collections.api.block.predicate.primitive.FloatPredicate;
import org.eclipse.collections.api.block.procedure.primitive.FloatIntProcedure;
import org.eclipse.collections.api.block.procedure.primitive.FloatProcedure;
import org.eclipse.collections.api.iterator.FloatIterator;
import org.eclipse.collections.api.list.primitive.FloatList;
import org.eclipse.collections.api.list.primitive.MutableFloatList;
import org.eclipse.collections.api.set.primitive.MutableFloatSet;
import org.eclipse.collections.api.stack.MutableStack;
import org.eclipse.collections.api.stack.primitive.ImmutableFloatStack;
import org.eclipse.collections.api.stack.primitive.MutableFloatStack;
import org.eclipse.collections.impl.factory.primitive.FloatStacks;
import org.eclipse.collections.impl.iterator.UnmodifiableFloatIterator;
import org.eclipse.collections.impl.lazy.primitive.LazyFloatIterableAdapter;

This file was automatically generated from template file unmodifiablePrimitiveStack.stg.
Since:3.1.
/** * This file was automatically generated from template file unmodifiablePrimitiveStack.stg. * * @since 3.1. */
public class UnmodifiableFloatStack implements MutableFloatStack, Serializable { private static final long serialVersionUID = 1L; private final MutableFloatStack stack; public UnmodifiableFloatStack(MutableFloatStack stack) { this.stack = stack; } @Override public void push(float item) { throw new UnsupportedOperationException("Cannot call push() on " + this.getClass().getSimpleName()); } @Override public float pop() { throw new UnsupportedOperationException("Cannot call pop() on " + this.getClass().getSimpleName()); } @Override public FloatList pop(int count) { throw new UnsupportedOperationException("Cannot call pop() on " + this.getClass().getSimpleName()); } @Override public float peek() { return this.stack.peek(); } @Override public FloatList peek(int count) { return this.stack.peek(count); } @Override public float peekAt(int index) { return this.stack.peekAt(index); } @Override public int size() { return this.stack.size(); } @Override public boolean isEmpty() { return this.stack.isEmpty(); } @Override public boolean notEmpty() { return this.stack.notEmpty(); } @Override public void clear() { throw new UnsupportedOperationException("Cannot call clear() on " + this.getClass().getSimpleName()); } @Override public boolean contains(float value) { return this.stack.contains(value); } @Override public boolean containsAll(float... source) { return this.stack.containsAll(source); } @Override public boolean containsAll(FloatIterable source) { return this.stack.containsAll(source); } @Override public FloatIterator floatIterator() { return new UnmodifiableFloatIterator(this.stack.floatIterator()); } @Override public void forEach(FloatProcedure procedure) { this.each(procedure); }
Since:7.0.
/** * @since 7.0. */
@Override public void each(FloatProcedure procedure) { this.stack.forEach(procedure); } @Override public int count(FloatPredicate predicate) { return this.stack.count(predicate); } @Override public boolean anySatisfy(FloatPredicate predicate) { return this.stack.anySatisfy(predicate); } @Override public boolean allSatisfy(FloatPredicate predicate) { return this.stack.allSatisfy(predicate); } @Override public boolean noneSatisfy(FloatPredicate predicate) { return this.stack.noneSatisfy(predicate); } @Override public float detectIfNone(FloatPredicate predicate, float ifNone) { return this.stack.detectIfNone(predicate, ifNone); } @Override public MutableFloatStack select(FloatPredicate predicate) { return this.stack.select(predicate); } @Override public MutableFloatStack reject(FloatPredicate predicate) { return this.stack.reject(predicate); } @Override public <V> MutableStack<V> collect(FloatToObjectFunction<? extends V> function) { return this.stack.collect(function); } @Override public double sum() { return this.stack.sum(); } @Override public float max() { return this.stack.max(); } @Override public float min() { return this.stack.min(); } @Override public float minIfEmpty(float defaultValue) { return this.stack.minIfEmpty(defaultValue); } @Override public float maxIfEmpty(float defaultValue) { return this.stack.maxIfEmpty(defaultValue); } @Override public double average() { return this.stack.average(); } @Override public double median() { return this.stack.median(); } @Override public MutableFloatList toSortedList() { return this.stack.toSortedList(); } @Override public float[] toSortedArray() { return this.stack.toSortedArray(); } @Override public float[] toArray() { return this.stack.toArray(); } @Override public float[] toArray(float[] target) { return this.stack.toArray(target); } @Override public String toString() { return this.stack.toString(); } @Override public String makeString() { return this.stack.makeString(); } @Override public String makeString(String separator) { return this.stack.makeString(separator); } @Override public String makeString(String start, String separator, String end) { return this.stack.makeString(start, separator, end); } @Override public void appendString(Appendable appendable) { this.stack.appendString(appendable); } @Override public void appendString(Appendable appendable, String separator) { this.stack.appendString(appendable, separator); } @Override public void appendString( Appendable appendable, String start, String separator, String end) { this.stack.appendString(appendable, start, separator, end); } @Override public MutableFloatList toList() { return this.stack.toList(); } @Override public MutableFloatSet toSet() { return this.stack.toSet(); } @Override public MutableFloatBag toBag() { return this.stack.toBag(); } @Override public boolean equals(Object otherStack) { return this.stack.equals(otherStack); } @Override public int hashCode() { return this.stack.hashCode(); } public LazyFloatIterable asLazy() { return new LazyFloatIterableAdapter(this); } @Override public MutableFloatStack asUnmodifiable() { return this; } @Override public MutableFloatStack asSynchronized() { return new SynchronizedFloatStack(this); } @Override public ImmutableFloatStack toImmutable() { return FloatStacks.immutable.withAllReversed(this); }
Since:9.2.
/** * @since 9.2. */
public MutableFloatStack newEmpty() { return this.stack.newEmpty(); } @Override public <T> T injectInto(T injectedValue, ObjectFloatToObjectFunction<? super T, ? extends T> function) { return this.stack.injectInto(injectedValue, function); } @Override public RichIterable<FloatIterable> chunk(int size) { return this.stack.chunk(size); } @Override public float getFirst() { return this.stack.getFirst(); } @Override public int indexOf(float value) { return this.stack.indexOf(value); } @Override public <T> T injectIntoWithIndex(T injectedValue, ObjectFloatIntToObjectFunction<? super T, ? extends T> function) { return this.stack.injectIntoWithIndex(injectedValue, function); } @Override public void forEachWithIndex(FloatIntProcedure procedure) { this.stack.forEachWithIndex(procedure); }
Returns a new MutableStack using results obtained by applying the specified function to each element and its corresponding index.
Since:9.1.
/** * Returns a new MutableStack using results obtained by applying the specified function to each element * and its corresponding index. * * @since 9.1. */
@Override public <V> MutableStack<V> collectWithIndex(FloatIntToObjectFunction<? extends V> function) { return this.stack.collectWithIndex(function); }
Adds elements to the target Collection using results obtained by applying the specified function to each element and its corresponding index.
Since:9.1.
/** * Adds elements to the target Collection using results obtained by applying the specified function to each element * and its corresponding index. * * @since 9.1. */
public <V, R extends Collection<V>> R collectWithIndex(FloatIntToObjectFunction<? extends V> function, R target) { return this.stack.collectWithIndex(function, target); } }