/** * Append given list buffer at length, forming and returning a new * list. */ public ImmutableList<A> appendList(final ListBuffer<A> x) { return appendList(x.toList()); }
/** * Append all elements in a list to buffer. */ public ListBuffer<A> appendList(final ListBuffer<A> xs) { return appendList(xs.toList()); }
public static <T> ListBuffer<T> of(final T x) { final ListBuffer<T> lb = new ListBuffer<>(); lb.add(x); return lb; }
/** * Construct a list consisting of given elements. */ public static <A> ImmutableList<A> of(final A x1, final A x2) { return new ImmutableList<>(x1, of(x2)); }
/** * Append given element at length, forming and returning * a new list. */ public ImmutableList<A> append(final A x) { return of(x).prependList(this); }
/** * Prepend an element to buffer. */ public ListBuffer<A> prepend(final A x) { elements = elements.prepend(x); count++; return this; }
/** * Does the list contain the specified element? */ public boolean contains(final Object x) { return elements.contains(x); }
/** * Gets a value indicating whether a cached value exists for the given key. */ public boolean contains(final K key) { return get(key) != null; }
@Override protected SatelliteCache<K, V> initialValue() { return new SatelliteCache<>(_parent); } };
public boolean containsAll(final Collection<?> c) { for (final Object x : c) { if (!contains(x)) { return false; } } return true; }
/** * Prepend given element to front of list, forming and returning * a new list. */ public ImmutableList<A> prepend(final A x) { return new ImmutableList<>(x, this); }
/** * Append given list at length, forming and returning * a new list. */ public ImmutableList<A> appendList(final ImmutableList<A> x) { return x.prependList(this); }
/** * Form a string listing all elements with comma as the separator character. */ @Override public String toString() { return toString(","); }
/** * Append given list buffer at length, forming and returning a new * list. */ public ImmutableList<A> appendList(final ListBuffer<A> x) { return appendList(x.toList()); }
/** * Construct a list consisting of given elements. */ public static <A> ImmutableList<A> of(final A x1, final A x2) { return new ImmutableList<>(x1, of(x2)); }
/** * Append given list buffer at length, forming and returning a new * list. */ public ImmutableList<A> appendList(final ListBuffer<A> x) { return appendList(x.toList()); }
/** * Construct a list consisting of given elements. */ public static <A> ImmutableList<A> of(final A x1, final A x2, final A x3) { return new ImmutableList<>(x1, of(x2, x3)); }