/** * {@inheritDoc} * * @throws NullPointerException * if the wrapped array was <code>null</code>. */ @Override public int lastIndexOf(Object o) { // Will make the method fail if array is null. if (size() < 1) { return -1; } if (o instanceof Byte) { return Bytes.lastIndexOf(array, ((Byte) o).byteValue()); } return -1; }
Object result = ((WrappedByteArray) value).internalToArray(); return checkComponentType(result, componentType);
return WrappedByteArray.create((byte[]) object);
/** * {@inheritDoc} * * @throws NullPointerException * if the wrapped array was <code>null</code>. */ @Override public boolean contains(Object o) { // Will make the method fail if array is null. if (size() < 1) { return false; } if (o instanceof Byte) { return Bytes.contains(array, ((Byte) o).byteValue()); } return false; }
/** * {@inheritDoc} * * @throws NullPointerException * if the wrapped array was <code>null</code>. */ @Override public int indexOf(Object o) { // Will make the method fail if array is null. if (size() < 1) { return -1; } if (o instanceof Byte) { return Bytes.indexOf(array, ((Byte) o).byteValue()); } return -1; }
/** * Creates a new {@link WrappedByteArray} that is backed by the given primitive {@code array}. * * @param array * the to-be-wrapped array. May be <code>null</code> which will cause any method on the resulting * object to fail. * @return the wrapped array. Never <code>null</code>. */ @Pure public static WrappedByteArray create(byte[] array) { return new WrappedByteArray(array); }