Interface AnswerList

All Superinterfaces:
AutoCloseable, Closeable, OsidList, OsidList

public interface AnswerList extends OsidList

Like all OsidLists , AnswerList provides a means for accessing Answer elements sequentially either one at a time or many at a time. Examples:

while (al.hasNext()) {
     Answer answer = al.getNextAnswer();
}            
  
or
while (al.hasNext()) {
     Answer[] answer = al.getNextAnswers(al.available());
}            
  
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the next Answer in this list.
    Gets the next set of Answer elements in this list which must be less than or equal to the number returned from available() .

    Methods inherited from interface Closeable

    close

    Methods inherited from interface OsidList

    close
    Modifier and Type
    Method
    Description
    void
    Close this list.

    Methods inherited from interface OsidList

    available, hasNext, skip
    Modifier and Type
    Method
    Description
    long
    Gets the number of elements available for retrieval.
    boolean
    Tests if there are more elements in this list.
    void
    skip(long n)
    Skip the specified number of elements in the list.
  • Method Details

    • getNextAnswer

      Answer getNextAnswer() throws OperationFailedException
      Gets the next Answer in this list.
      Returns:
      the next Answer in this list. The hasNext() method should be used to test that a next Answer is available before calling this method.
      Throws:
      IllegalStateException - no more elements available in this list
      OperationFailedException - unable to complete request
      Compliance:
      mandatory - This method must be implemented.
    • getNextAnswers

      Answer[] getNextAnswers(long n) throws OperationFailedException
      Gets the next set of Answer elements in this list which must be less than or equal to the number returned from available() .
      Parameters:
      n - the number of Answer elements requested which should be less than or equal to available()
      Returns:
      an array of Answer elements. The length of the array is less than or equal to the number specified.
      Throws:
      IllegalStateException - no more elements available in this list
      OperationFailedException - unable to complete request
      Compliance:
      mandatory - This method must be implemented.