/** * Removes a single instance of the specified element from this set, if it is present * Null values are considered never present. * * @param element element to be removed from this set, if present. Can be {@code null}. * @return {@code true} if the set contained the specified element. */ @Override public synchronized boolean remove(final Object element) { return intern(element, REMOVE) != null; }
/** * Returns {@code true} if this set contains the specified element. * Null values are considered never present. * * @param element object to be checked for containment in this set. Can be {@code null}. * @return {@code true} if this set contains the specified element. */ @Override public synchronized boolean contains(final Object element) { return intern(element, GET) != null; }
/** * Removes a single instance of the specified element from this set, if it is present * Null values are considered never present. * * @param element element to be removed from this set, if present. Can be {@code null}. * @return {@code true} if the set contained the specified element. */ @Override public synchronized boolean remove(final Object element) { return intern(element, REMOVE) != null; }
/** * Returns an object equals to the specified object, if present. If this set doesn't * contain any object equals to {@code element}, then this method returns {@code null}. * Null values are considered never present. * * @param element the element to get. * @return an element equals to the given one if already presents in the set, * or {@code null} otherwise. * * @see #unique(Object) */ public synchronized E get(final Object element) { return intern(element, GET); }
/** * Returns {@code true} if this set contains the specified element. * Null values are considered never present. * * @param element object to be checked for containment in this set. Can be {@code null}. * @return {@code true} if this set contains the specified element. */ @Override public synchronized boolean contains(final Object element) { return intern(element, GET) != null; }
/** * Returns an object equals to the specified object, if present. If this set doesn't * contain any object equals to {@code element}, then this method returns {@code null}. * Null values are considered never present. * * @param element the element to get. * @return an element equals to the given one if already presents in the set, * or {@code null} otherwise. * * @see #unique(Object) */ public synchronized E get(final Object element) { return intern(element, GET); }
return (T) intern(element, INTERN);
return (T) intern(element, INTERN);
/** * Adds the specified element to this set if it is not already present. * If this set already contains the specified element, the call leaves * this set unchanged and returns {@code false}. * * @param element element to be added to this set. * @return {@code true} if this set did not already contain the specified element. * @throws NullArgumentException if the given object is {@code null}. */ @Override public synchronized boolean add(final E element) throws NullArgumentException { ArgumentChecks.ensureNonNull("element", element); return intern(element, ADD) == null; }
/** * Adds the specified element to this set if it is not already present. * If this set already contains the specified element, the call leaves * this set unchanged and returns {@code false}. * * @param element element to be added to this set. * @return {@code true} if this set did not already contain the specified element. * @throws NullArgumentException if the given object is {@code null}. */ @Override public synchronized boolean add(final E element) throws NullArgumentException { ArgumentChecks.ensureNonNull("element", element); return intern(element, ADD) == null; }