javolution.util.internal.collection.SequentialCollectionImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javolution-core-java-msftbx Show documentation
Show all versions of javolution-core-java-msftbx Show documentation
Only the Java Core part of Javolution library, with slight modifications for use in MSFTBX.
/*
* Javolution - Java(TM) Solution for Real-Time and Embedded Systems
* Copyright (C) 2012 - Javolution (http://javolution.org/)
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software is
* freely granted, provided that this notice is preserved.
*/
package javolution.util.internal.collection;
import java.util.Iterator;
import javolution.util.function.Consumer;
import javolution.util.function.Equality;
import javolution.util.service.CollectionService;
/**
* A sequential view over a collection.
*/
public class SequentialCollectionImpl extends CollectionView {
private static final long serialVersionUID = 0x600L; // Version.
public SequentialCollectionImpl(CollectionService target) {
super(target);
}
@Override
public boolean add(E e) {
return target().add(e);
}
@Override
public void clear() {
target().clear();
}
@Override
public Equality super E> comparator() {
return target().comparator();
}
@Override
public boolean contains(Object obj) {
return target().contains(obj);
}
@Override
public boolean isEmpty() {
return target().isEmpty();
}
@Override
public Iterator iterator() {
return target().iterator();
}
@Override
public void perform(Consumer> action, CollectionService view) {
action.accept(view); // Executes immediately.
}
@Override
public boolean remove(Object obj) {
return target().remove(obj);
}
@Override
public int size() {
return target().size();
}
@Override
public CollectionService[] split(int n, boolean threadsafe) {
return target().split(n, threadsafe); // Forwards.
}
@Override
public void update(Consumer> action, CollectionService view) {
action.accept(view); // Executes immediately.
}
}