public static <T> CompositeDomainObjectSet<T> create(Class<T> type, DomainObjectCollection<? extends T>... collections) { //noinspection unchecked DefaultDomainObjectSet<T> backingSet = new DefaultDomainObjectSet<T>(type, new CompositeCollection()); CompositeDomainObjectSet<T> out = new CompositeDomainObjectSet<T>(backingSet); for (DomainObjectCollection<? extends T> c : collections) { out.addCollection(c); } return out; }
@SuppressWarnings({"NullableProblems", "unchecked"}) @Override public Iterator<T> iterator() { CompositeCollection store = getStore(); if (store.isEmpty()) { return Iterators.emptyIterator(); } return new SetIterator(); }
@SuppressWarnings("unchecked") public int size() { CompositeCollection store = getStore(); if (store.isEmpty()) { return 0; } return new HashSet<T>(store).size(); }
/** * Returns a collection of all axes, including the slicer as the first * element, if there is a slicer. * * @return Collection of all axes including slicer */ private Collection<QueryAxis> allAxes() { if (slicerAxis == null) { return Arrays.asList(axes); } else { //noinspection unchecked return new CompositeCollection( new Collection[] { Collections.singletonList(slicerAxis), Arrays.asList(axes)}); } }
@SuppressWarnings("unchecked") protected CompositeCollection getStore() { return (CompositeCollection) this.backingSet.getStore(); }
public CompositeDomainObjectSet(Class<T> type) { //noinspection unchecked super(type, new CompositeCollection()); }
@SuppressWarnings("unchecked") protected CompositeCollection getStore() { return (CompositeCollection)super.getStore(); }