/** * Replaces the element at the specified position in this list with the specified element. * * @param index index of element to replace. * @param element element to be stored at the specified position. * @return the element previously at the specified position. * @throws IndexOutOfBoundsException if index out of range. * @throws NullPointerException if the given element is {@code null}. * @throws ClassCastException if the given element is not of the expected type. */ @Override public E set(final int index, final E element) { if (ensureValid(element)) { return super.set(index, element); } return get(index); }
/** * Replaces the element at the specified position in this list with the specified element. * * @param index index of element to replace. * @param element element to be stored at the specified position. * @return the element previously at the specified position. * @throws IndexOutOfBoundsException if index out of range. * @throws NullPointerException if the given element is {@code null}. * @throws ClassCastException if the given element is not of the expected type. */ @Override public E set(final int index, final E element) { if (ensureValid(element)) { return super.set(index, element); } return get(index); }
/** * Returns the feature, or {@code null} if none. * * @return the feature (may be {@code null}). * @throws IllegalStateException if this association contains more than one value. */ @Override public AbstractFeature getValue() { switch (values.size()) { case 0: return null; case 1: return values.get(0); default: throw new IllegalStateException(Resources.format(Resources.Keys.NotASingleton_1, getName())); } }
/** * Returns the attribute value, or {@code null} if none. * * @return the attribute value (may be {@code null}). * @throws IllegalStateException if this attribute contains more than one value. */ @Override public V getValue() { switch (values.size()) { case 0: return null; case 1: return values.get(0); default: throw new IllegalStateException(Resources.format(Resources.Keys.NotASingleton_1, getName())); } }
/** * Returns the attribute value, or {@code null} if none. * * @return the attribute value (may be {@code null}). * @throws IllegalStateException if this attribute contains more than one value. */ @Override public V getValue() { switch (values.size()) { case 0: return null; case 1: return values.get(0); default: throw new IllegalStateException(Resources.format(Resources.Keys.NotASingleton_1, getName())); } }
/** * Returns the feature, or {@code null} if none. * * @return the feature (may be {@code null}). * @throws IllegalStateException if this association contains more than one value. */ @Override public AbstractFeature getValue() { switch (values.size()) { case 0: return null; case 1: return values.get(0); default: throw new IllegalStateException(Resources.format(Resources.Keys.NotASingleton_1, getName())); } }