All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.codefilarete.tool.collection.SetWrapper Maven / Gradle / Ivy

package org.codefilarete.tool.collection;

import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
import java.util.Spliterator;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Stream;

/**
 * {@link Set} that wraps another one and delegates all its methods to it without any additionnal feature.
 * Made for overriding only some targeted methods.
 * 
 * @author Guillaume Mary
 */
public class SetWrapper implements Set {
	
	private final Set surrogate;
	
	public SetWrapper(Set surrogate) {
		this.surrogate = surrogate;
	}
	
	public Set getSurrogate() {
		return surrogate;
	}
	
	@Override
	public int size() {
		return surrogate.size();
	}
	
	@Override
	public boolean isEmpty() {
		return surrogate.isEmpty();
	}
	
	@Override
	public boolean contains(Object o) {
		return surrogate.contains(o);
	}
	
	@Override
	public Iterator iterator() {
		return surrogate.iterator();
	}
	
	@Override
	public Object[] toArray() {
		return surrogate.toArray();
	}
	
	@Override
	public  T[] toArray(T[] a) {
		return surrogate.toArray(a);
	}
	
	@Override
	public boolean add(E e) {
		return surrogate.add(e);
	}
	
	@Override
	public boolean remove(Object o) {
		return surrogate.remove(o);
	}
	
	@Override
	public boolean containsAll(Collection c) {
		return surrogate.containsAll(c);
	}
	
	@Override
	public boolean addAll(Collection c) {
		return surrogate.addAll(c);
	}
	
	@Override
	public boolean retainAll(Collection c) {
		return surrogate.retainAll(c);
	}
	
	@Override
	public boolean removeAll(Collection c) {
		return surrogate.removeAll(c);
	}
	
	@Override
	public void clear() {
		surrogate.clear();
	}
	
	@Override
	public boolean equals(Object o) {
		return surrogate.equals(o);
	}
	
	@Override
	public int hashCode() {
		return surrogate.hashCode();
	}
	
	@Override
	public Spliterator spliterator() {
		return surrogate.spliterator();
	}
	
	@Override
	public boolean removeIf(Predicate filter) {
		return surrogate.removeIf(filter);
	}
	
	@Override
	public Stream stream() {
		return surrogate.stream();
	}
	
	@Override
	public Stream parallelStream() {
		return surrogate.parallelStream();
	}
	
	@Override
	public void forEach(Consumer action) {
		surrogate.forEach(action);
	}
	
	@Override
	public String toString() {
		return surrogate.toString();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy