/** * Returns a list containing the classes of the elements of the tuple. * * @param <T> the common of the classes contained by the tuple. * @param tuple the tuple to convert. * @return the list of classes. */ @SuppressWarnings("unchecked") public static <T> Class<T>[] itemClasses(Tuple tuple) { Class<?>[] itemClasses = new Class[tuple.getSize()]; int index = 0; for (Object o : tuple) { itemClasses[index++] = o.getClass(); } return (Class<T>[]) itemClasses; } }
public final int lastIndexOf(final Object value) { for (int i = getSize() - 1; i >= 0; i--) { final Object val = this.valueList.get(i); if (val == null) { if (value == null) { return i; } } else { if (val.equals(value)) { return i; } } } return -1; }
/** * <p> * Get the value at a specific position in the tuple. This method * has to return object, so using it you will lose the type-safety you * get with the <tt>getValueX()</tt> methods. * </p> * * @param pos the position of the value to be retrieved. * @return the value */ public final Object getValue(final int pos) { if (pos >= getSize()) { throw new IllegalArgumentException( "Cannot retrieve position " + pos + " in " + this.getClass().getSimpleName() + ". Positions for this class start with 0 and end with " + (getSize() - 1)); } return this.valueArray[pos]; }
public final int lastIndexOf(final Object value) { for (int i = getSize() - 1; i >= 0; i--) { final Object val = this.valueList.get(i); if (val == null) { if (value == null) { return i; } } else { if (val.equals(value)) { return i; } } } return -1; }
/** * <p> * Get the value at a specific position in the tuple. This method * has to return object, so using it you will lose the type-safety you * get with the <tt>getValueX()</tt> methods. * </p> * * @param pos the position of the value to be retrieved. * @return the value */ public final Object getValue(final int pos) { if (pos >= getSize()) { throw new IllegalArgumentException( "Cannot retrieve position " + pos + " in " + this.getClass().getSimpleName() + ". Positions for this class start with 0 and end with " + (getSize() - 1)); } return this.valueArray[pos]; }