net.dongliu.commons.collection.ExLinkedHashSet Maven / Gradle / Ivy
The newest version!
package net.dongliu.commons.collection;
import java.util.Collection;
import java.util.LinkedHashSet;
/**
* Expanded linked hash set
*
* @author Liu Dong
*/
public class ExLinkedHashSet extends LinkedHashSet implements ExSet {
private static final long serialVersionUID = -3575142697097689727L;
public ExLinkedHashSet(int initialCapacity, float loadFactor) {
super(initialCapacity, loadFactor);
}
public ExLinkedHashSet(int initialCapacity) {
super(initialCapacity);
}
public ExLinkedHashSet() {
}
public ExLinkedHashSet(Collection c) {
super(c);
}
/**
* Create mutable set
*/
public static ExLinkedHashSet of() {
return new ExLinkedHashSet<>();
}
/**
* Create mutable set
*/
public static ExLinkedHashSet of(T value) {
ExLinkedHashSet list = new ExLinkedHashSet<>();
list.add(value);
return list;
}
/**
* Create mutable set
*/
public static ExLinkedHashSet of(T value1, T value2) {
ExLinkedHashSet list = new ExLinkedHashSet<>();
list.add(value1);
list.add(value2);
return list;
}
/**
* Create mutable set
*/
public static ExLinkedHashSet of(T value1, T value2, T value3) {
ExLinkedHashSet list = new ExLinkedHashSet<>();
list.add(value1);
list.add(value2);
list.add(value3);
return list;
}
/**
* Create mutable set
*/
public static ExLinkedHashSet of(T value1, T value2, T value3, T value4) {
ExLinkedHashSet list = new ExLinkedHashSet<>();
list.add(value1);
list.add(value2);
list.add(value3);
list.add(value4);
return list;
}
/**
* Create mutable set
*/
public static ExLinkedHashSet of(T value1, T value2, T value3, T value4, T value5) {
ExLinkedHashSet list = new ExLinkedHashSet<>();
list.add(value1);
list.add(value2);
list.add(value3);
list.add(value4);
list.add(value5);
return list;
}
/**
* Create mutable set
*/
public static ExLinkedHashSet of(T value1, T value2, T value3, T value4, T value5,
T value6) {
ExLinkedHashSet list = new ExLinkedHashSet<>();
list.add(value1);
list.add(value2);
list.add(value3);
list.add(value4);
list.add(value5);
list.add(value6);
return list;
}
/**
* Create mutable set
*/
public static ExLinkedHashSet of(T value1, T value2, T value3, T value4, T value5,
T value6, T value7) {
ExLinkedHashSet list = new ExLinkedHashSet<>();
list.add(value1);
list.add(value2);
list.add(value3);
list.add(value4);
list.add(value5);
list.add(value6);
list.add(value7);
return list;
}
@SafeVarargs
public static ExLinkedHashSet of(T... values) {
ExLinkedHashSet list = new ExLinkedHashSet<>();
list.addAll(values);
return list;
}
}