On 06/20/2012 12:19 AM, sebb wrote: > On 19 June 2012 22:05, <[email protected]> wrote: >> Author: tn >> Date: Tue Jun 19 21:05:48 2012 >> New Revision: 1351852 >> >> URL: http://svn.apache.org/viewvc?rev=1351852&view=rev >> Log: >> [COLLECTIONS-399] Added get(index) method to BoundedFifoBuffer. >> >> Modified: >> >> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BoundedFifoBuffer.java >> >> commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/buffer/TestBoundedFifoBuffer.java >> >> commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/buffer/TestCircularFifoBuffer.java >> >> Modified: >> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BoundedFifoBuffer.java >> URL: >> http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BoundedFifoBuffer.java?rev=1351852&r1=1351851&r2=1351852&view=diff >> ============================================================================== >> --- >> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BoundedFifoBuffer.java >> (original) >> +++ >> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/buffer/BoundedFifoBuffer.java >> Tue Jun 19 21:05:48 2012 >> @@ -131,7 +131,7 @@ public class BoundedFifoBuffer<E> extend >> * Write the buffer out using a custom routine. >> * >> * @param out the output stream >> - * @throws IOException >> + * @throws IOException if an I/O error occurs while writing to the >> output stream >> */ >> private void writeObject(ObjectOutputStream out) throws IOException { >> out.defaultWriteObject(); >> @@ -145,8 +145,8 @@ public class BoundedFifoBuffer<E> extend >> * Read the buffer in using a custom routine. >> * >> * @param in the input stream >> - * @throws IOException >> - * @throws ClassNotFoundException >> + * @throws IOException if an I/O error occurs while writing to the >> output stream >> + * @throws ClassNotFoundException if the class of a serialized object >> can not be found >> */ >> @SuppressWarnings("unchecked") >> private void readObject(ObjectInputStream in) throws IOException, >> ClassNotFoundException { >> @@ -270,6 +270,22 @@ public class BoundedFifoBuffer<E> extend >> } >> >> /** >> + * Returns the element at the specified position in this buffer. >> + * >> + * @param index the position of the element in the buffer >> + * @return the element at position {@code index} >> + * @throws NoSuchElementException if the requested position is outside >> the range [0, size) >> + */ >> + public E get(int index) { >> + if (index < 0 || index >= size()) { >> + throw new NoSuchElementException(); > > It would be helpful to show the values of index and size().
done. Thanks for looking at it. Thomas --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
