/** * Gets a property for an index. * * @param index the index of the property to return. * * @return a reference to the property at {@code index}. * * @throws IndexOutOfBoundsException if {@code index} is negativ, * greater than or equal to {@code size()}. */ public final Property getProperty( final int index ) { if ( index < 0 || index >= this.size() ) { throw new ArrayIndexOutOfBoundsException( index ); } return this.getProperties()[index]; }
/** * Indicates whether some other object is equal to this one by comparing * the values of all properties. * * @param o the reference object with which to compare. * * @return {@code true} if this object is the same as {@code o}; * {@code false} otherwise. */ public boolean equals( final Object o ) { boolean equal = this == o; if ( !equal && o instanceof Properties ) { final Properties that = (Properties) o; final Collection these = Arrays.asList( this.getProperties() ); final Collection those = Arrays.asList( that.getProperties() ); equal = this.size() == that.size() && these.containsAll( those ); } return equal; }