Package com.gs.collections.impl.list.mutable.primitive

Source Code of com.gs.collections.impl.list.mutable.primitive.UnmodifiableIntList

/*
* Copyright 2014 Goldman Sachs.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.gs.collections.impl.list.mutable.primitive;

import com.gs.collections.api.IntIterable;
import com.gs.collections.api.LazyIntIterable;
import com.gs.collections.api.block.function.primitive.IntToObjectFunction;
import com.gs.collections.api.block.function.primitive.ObjectIntToObjectFunction;
import com.gs.collections.api.block.function.primitive.ObjectIntIntToObjectFunction;
import com.gs.collections.api.block.predicate.primitive.IntPredicate;
import com.gs.collections.api.block.procedure.primitive.IntIntProcedure;
import com.gs.collections.api.list.MutableList;
import com.gs.collections.api.list.primitive.IntList;
import com.gs.collections.api.list.primitive.ImmutableIntList;
import com.gs.collections.api.list.primitive.MutableIntList;
import com.gs.collections.impl.collection.mutable.primitive.AbstractUnmodifiableIntCollection;
import com.gs.collections.impl.factory.primitive.IntLists;
import com.gs.collections.impl.lazy.primitive.LazyIntIterableAdapter;
import com.gs.collections.impl.lazy.primitive.ReverseIntIterable;
import net.jcip.annotations.NotThreadSafe;

/**
* This file was automatically generated from template file unmodifiablePrimitiveList.stg.
*
* @since 3.1.
*/
@NotThreadSafe
public final class UnmodifiableIntList
        extends AbstractUnmodifiableIntCollection
        implements MutableIntList
{
    private static final long serialVersionUID = 1L;

    UnmodifiableIntList(MutableIntList list)
    {
        super(list);
    }

    private MutableIntList getMutableIntList()
    {
        return (MutableIntList) this.getIntCollection();
    }

    public int get(int index)
    {
        return this.getMutableIntList().get(index);
    }

    public int getFirst()
    {
        return this.getMutableIntList().getFirst();
    }

    public int getLast()
    {
        return this.getMutableIntList().getLast();
    }

    public int indexOf(int value)
    {
        return this.getMutableIntList().indexOf(value);
    }

    public int lastIndexOf(int value)
    {
        return this.getMutableIntList().lastIndexOf(value);
    }

    public void addAtIndex(int index, int element)
    {
        throw new UnsupportedOperationException("Cannot call addAtIndex() on " + this.getClass().getSimpleName());
    }

    public boolean addAllAtIndex(int index, int... source)
    {
        throw new UnsupportedOperationException("Cannot call addAllAtIndex() on " + this.getClass().getSimpleName());
    }

    public boolean addAllAtIndex(int index, IntIterable source)
    {
        throw new UnsupportedOperationException("Cannot call addAllAtIndex() on " + this.getClass().getSimpleName());
    }

    public int removeAtIndex(int index)
    {
        throw new UnsupportedOperationException("Cannot call removeAtIndex() on " + this.getClass().getSimpleName());
    }

    public int set(int index, int element)
    {
        throw new UnsupportedOperationException("Cannot call set() on " + this.getClass().getSimpleName());
    }

    @Override
    public UnmodifiableIntList with(int element)
    {
        throw new UnsupportedOperationException("Cannot call with() on " + this.getClass().getSimpleName());
    }

    @Override
    public UnmodifiableIntList without(int element)
    {
        throw new UnsupportedOperationException("Cannot call without() on " + this.getClass().getSimpleName());
    }

    @Override
    public UnmodifiableIntList withAll(IntIterable elements)
    {
        throw new UnsupportedOperationException("Cannot call withAll() on " + this.getClass().getSimpleName());
    }

    @Override
    public UnmodifiableIntList withoutAll(IntIterable elements)
    {
        throw new UnsupportedOperationException("Cannot call withoutAll() on " + this.getClass().getSimpleName());
    }

    @Override
    public MutableIntList select(IntPredicate predicate)
    {
        return this.getMutableIntList().select(predicate);
    }

    @Override
    public MutableIntList reject(IntPredicate predicate)
    {
        return this.getMutableIntList().reject(predicate);
    }

    @Override
    public <V> MutableList<V> collect(IntToObjectFunction<? extends V> function)
    {
        return this.getMutableIntList().collect(function);
    }

    public MutableIntList sortThis()
    {
        throw new UnsupportedOperationException("Cannot call sortThis() on " + this.getClass().getSimpleName());
    }

    public long dotProduct(IntList list)
    {
        return this.getMutableIntList().dotProduct(list);
    }

    @Override
    public boolean equals(Object otherList)
    {
        return this.getMutableIntList().equals(otherList);
    }

    @Override
    public int hashCode()
    {
        return this.getMutableIntList().hashCode();
    }

    @Override
    public LazyIntIterable asLazy()
    {
        return new LazyIntIterableAdapter(this);
    }

    @Override
    public MutableIntList asUnmodifiable()
    {
        return this;
    }

    @Override
    public MutableIntList asSynchronized()
    {
        return new SynchronizedIntList(this);
    }

    @Override
    public ImmutableIntList toImmutable()
    {
        int size = this.size();
        if (size == 0)
        {
            return IntLists.immutable.with();
        }
        if (size == 1)
        {
            return IntLists.immutable.with(this.getFirst());
        }
        return IntLists.immutable.with(this.toArray());
    }

    public MutableIntList reverseThis()
    {
        throw new UnsupportedOperationException("Cannot call reverseThis() on " + this.getClass().getSimpleName());
    }

    public MutableIntList toReversed()
    {
        return this.getMutableIntList().toReversed();
    }

    public void forEachWithIndex(IntIntProcedure procedure)
    {
        this.getMutableIntList().forEachWithIndex(procedure);
    }

    public LazyIntIterable asReversed()
    {
        return ReverseIntIterable.adapt(this);
    }

    public <T> T injectInto(T injectedValue, ObjectIntToObjectFunction<? super T, ? extends T> function)
    {
        return this.getMutableIntList().injectInto(injectedValue, function);
    }

    public <T> T injectIntoWithIndex(T injectedValue, ObjectIntIntToObjectFunction<? super T, ? extends T> function)
    {
        return this.getMutableIntList().injectIntoWithIndex(injectedValue, function);
    }

    public MutableIntList subList(int fromIndex, int toIndex)
    {
        throw new UnsupportedOperationException("subList not yet implemented!");
    }
}
TOP

Related Classes of com.gs.collections.impl.list.mutable.primitive.UnmodifiableIntList

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.