Java Collection Interfaces Overview
34 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which of the following methods is available in the ResultSet interface?

  • deleteRow() (correct)
  • getRowCount()
  • addRow()
  • updateRow()
  • The ArrayList class implementation is a resizable array of objects.

    True

    What constant indicates that open ResultSet objects will remain open when the current transaction is committed?

    HOLD_CURSORS_OVER_COMMIT

    What is a feature of the CopyOnWriteArrayList?

    <p>Thread-safe</p> Signup and view all the answers

    Which of these is an implementation of the Queue interface?

    <p>LinkedBlockingQueue</p> Signup and view all the answers

    The method _____ moves the cursor to the end of the ResultSet object.

    <p>afterLast()</p> Signup and view all the answers

    Which method is used to clear all warnings reported on a ResultSet object?

    <p>clearWarnings()</p> Signup and view all the answers

    Select the implementations of the BlockingQueue interface.

    <p>LinkedBlockingQueue</p> Signup and view all the answers

    What is the purpose of the FETCH_FORWARD constant?

    <p>Indicates that rows will be processed in a forward direction.</p> Signup and view all the answers

    What does the 'pollLast()' method do in the Deque interface?

    <p>Removes and returns the last element.</p> Signup and view all the answers

    The ConcurrentSkipListSet is a non-scalable navigable set implementation.

    <p>False</p> Signup and view all the answers

    Which of the following methods in ResultSet allows moving the cursor to the first row?

    <p>first()</p> Signup and view all the answers

    Match the following classes with their descriptions:

    <p>ArrayList = A resizable array of objects LinkedBlockingQueue = A blocking queue based on linked nodes Vector = A resizable array that is synchronized CopyOnWriteArraySet = A thread-safe set implementation</p> Signup and view all the answers

    What does the method getObject(String columnLabel, Class type) return?

    <p>The value of the designated column in the current row converted to the requested Java data type</p> Signup and view all the answers

    What is the return type of getArray(int columnIndex)?

    <p>Array</p> Signup and view all the answers

    The method getBigDecimal(String columnLabel, int scale) is still recommended for use.

    <p>False</p> Signup and view all the answers

    What does the method getDate(int columnIndex) return?

    <p>java.sql.Date</p> Signup and view all the answers

    Which method retrieves the current row number?

    <p>getRow()</p> Signup and view all the answers

    What method would you use to retrieve the first row of a ResultSet object?

    <p>first()</p> Signup and view all the answers

    What does the method getWarnings() return?

    <p>The first warning reported by calls on the ResultSet object</p> Signup and view all the answers

    The method close() releases the ResultSet object's database resources immediately.

    <p>True</p> Signup and view all the answers

    Match the following method signatures with their return types:

    <p>getBoolean(String columnLabel) = boolean getDouble(int columnIndex) = double getBlob(String columnLabel) = Blob getSQLXML(int columnIndex) = SQLXML</p> Signup and view all the answers

    The method getString(int columnIndex) retrieves the value of the designated column as a ______ in Java.

    <p>String</p> Signup and view all the answers

    What does the method updateBigDecimal(String columnLabel, BigDecimal x) do?

    <p>Updates the designated column with a java.sql.BigDecimal value.</p> Signup and view all the answers

    What is the purpose of updateBinaryStream(String columnLabel, InputStream x)?

    <p>Updates the designated column with a binary stream value.</p> Signup and view all the answers

    What type of value does updateBlob(String columnLabel, Blob x) update the designated column with?

    <p>java.sql.Blob value.</p> Signup and view all the answers

    What does updateBoolean(String columnLabel, boolean x) do?

    <p>Updates the designated column with a boolean value.</p> Signup and view all the answers

    What kind of value is updated by updateDate(String columnLabel, Date x)?

    <p>java.sql.Date value.</p> Signup and view all the answers

    What is updated by the method updateFloat(int columnIndex, float x)?

    <p>Updates the designated column with a float value.</p> Signup and view all the answers

    What does updateNClob(String columnLabel, NClob nClob) accomplish?

    <p>Updates the designated column with a java.sql.NClob value.</p> Signup and view all the answers

    What does updateNull(int columnIndex) do?

    <p>Updates the designated column with a null value.</p> Signup and view all the answers

    What is the role of updateTimestamp(String columnLabel, Timestamp x)?

    <p>Updates the designated column with a java.sql.Timestamp value.</p> Signup and view all the answers

    Which of the following are types of result set constants? (Select all that apply)

    <p>CLOSE_CURSORS_AT_COMMIT</p> Signup and view all the answers

    The constant FETCH_REVERSE indicates that rows will be processed from first to last.

    <p>False</p> Signup and view all the answers

    Study Notes

    Interface Implementations

    • The Collection interface has implementations that include add, clear, addAll, contains, containsAll, and removeRange.
    • The List interface has implementations that include add, addAll, get, indexOf, lastIndexOf, listIterator, remove, replaceAll, sort, and subList.
    • The Deque interface has implementations that include offerFirst, offerLast, peekFirst, peekLast, pollFirst, pollLast, pop, push, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, addFirst, addLast, descendingIterator, element, getFirst, and getLast.
    • The Queue interface has implementations that include element, offer, peek, poll, and remove.
    • The Set interface has implementations that include offerFirst, offerLast, pollFirst, and pollLast.
    • The Blocking interface has implementations that include takeFirst, takeLast, putFirst, putLast, offerFirst, offerLast, pollFirst, and pollLast.
    • The Blocking interface also has implementations that include take, put, offer, and poll.
    • The NavigableSet interface includes implementations that include ceiling, comparator, descendingIterator, descendingSet, floor, headSet, higher, lower, pollFirst, pollLast, subSet, and tailSet.
    • The SortedSet interface has implementations that include comparator, first, headSet, last, spliterator, subSet, and tailSet.

    List Implementations

    • AbstractList is a skeletal implementation for the List interface.
    • AbstractSequentialList is a skeletal implementation for the LinkedList interface.
    • ArrayList is a resizable array that holds objects.
    • AttributeList holds a list of values for an Mbean.
    • CopyOnWriteArrayList is a thread-safe arraylist that copies the underlying array on every modification, making it suitable for use within multiple threads.
    • LinkedList is a doubly linked list that implements the List and the Deque interfaces.
    • RoleList is a list of Role objects designed for use with relation functions.
    • RoleUnresolvedList is a list of RoleUnresolved objects.
    • Vector is a resizable array that holds objects.

    Queue Implementations

    • AbstractQueue is a skeletal implementation for the Queue interface.
    • ArrayBlockingQueue is a bounded blocking queue.
    • ArrayDeque is a resizable array that implements the Deque interface.
    • ConcurrentLinkedDeque is a concurrent implementation of Deque that is unbounded.
    • ConcurrentLinkedQueue is a concurrent implementation of Queue that is unbounded.
    • DelayQueue is an unbounded blocking queue that holds elements that remain in queue until their delay has expired.
    • LinkedBlockingQueue is an optionally bounded blocking deque implemented as linked nodes.
    • LinkedBlockingDeque is an optionally bounded blocking queue implemented as linked nodes.
    • LinkedTransferQueue is an unbounded transfer queue based on linked nodes.
    • PriorityBlockingQueue is an unbounded blocking queue that orders like PriorityQueue.
    • PriorityQueue is an unbounded priority queue based on the priority heap.
    • SynchronousQueue is a blocking queue each insert operation must wait on a corresponding remove operation by another thread, and vice versa.

    Set Implementations

    • AbstractSet is a skeletal implementation for the Set interface.
    • ConcurrentHashMap.KeySetView is a concurrent HashMap as a set of Keys.
    • ConcurrentSkipListSet is a scalable concurrent navigable set.
    • CopyOnWriteArraySet is a thread-safe arraylist in which all mutative operations generate a new copy of the underlying array.
    • EnumSet is a specialized set implementation that works with Enumerations (Enums).
    • HashSet implements the Set interface, backing by data by a hash table.
    • JobStateReasons is a print attribute class that describes the state of a print job.
    • LinkedHashSet is a LinkedList implementation of the Set interface that maintains order without using TreeSet.
    • TreeSet is a navigable set implementation based on TreeMap.

    Synchronization

    • The Array data structure permits nulls, can be a RAD such as an array, is resizable, is an ArrayList, and is a List and Deque with sequential access.
    • ArrayList permits nulls, can be a RAD, is resizable, and is an ArrayList.
    • ArrayList permits nulls, is a RAD, is resizable, and is an ArrayList.
    • GrowableArray permits nulls, can be a RAD, and is resizable.
    • BlockingQueue does not permit nulls, is not a RAD, is not resizable, and is not a List, Deque, or ArrayList.
    • Nodes are resizable.
    • Nodes are not resizable.

    JDBC - ResultSet

    Constants

    • CLOSE_CURSORS_AT_COMMIT: Indicates that open ResultSet objects will be closed when the current transaction is committed.
    • CONCUR_READ_ONLY: Indicates that the concurrency mode for a ResultSet object means it cannot be updated.
    • CONCUR_UPDATABLE: Indicates that the concurrency mode for a ResultSet object means it can be updated.
    • FETCH_FORWARD: The constant indicating that the rows in a result set will be processed in a forward direction; first-to-last.
    • FETCH_REVERSE: The constant indicating that the rows in a result set will be processed in a reverse direction; last-to-first.
    • FETCH_UNKNOWN: The constant indicating that the order in which rows in a result set will be processed is unknown.
    • HOLD_CURSORS_OVER_COMMIT: Indicates that open ResultSet objects will remain open when the current transaction is committed.
    • TYPE_FORWARD_ONLY: Indicates the type for a ResultSet object whose cursor may move only forward.
    • TYPE_SCROLL_INSENSITIVE: Indicates the type for a ResultSet object that is scrollable but not generally sensitive to changes to the data that underlies the ResultSet.
    • TYPE_SCROLL_SENSITIVE: Indicates the type for a ResultSet object that is scrollable and generally sensitive to changes to the data that underlies the ResultSet.

    Methods

    • afterLast(): Moves the cursor to the end of the ResultSet object, just after the last row.
    • beforeFirstRow(): Moves the cursor to the front of the ResultSet object, just before the first row.
    • cancelRowUpdates(): Cancels updates made to the current row in this ResultSet object.
    • clearWarnings(): Clears any warnings reported on this ResultSet object.
    • close(): Releases the database and JDBC resources for this ResultSet object immediately.
    • deleteRow(): Deletes the current row from the ResultSet object and from the underlying database.
    • findColumn(String columnName): Maps the given ResultSet column label to its ResultSet column index.
    • first(): Moves the cursor to the first row in this ResultSet object.
    • getConcurrency(): Retrieves the concurrency mode of this ResultSet object.
    • getCursorName(): Retrieves the name of the SQL cursor used by this ResultSet object.
    • getFetchDirection(): Retrieves the fetch direction for this ResultSet object.
    • getFetchSize(): Retrieves the fetch size for this ResultSet object.
    • getHoldability(): Retrieves the holdability of this ResultSet object.
    • getMetaData(): Retrieves the number, types, and properties of this ResultSet object's columns.
    • getRow(): Retrieves the current row number.
    • getType(): Retrieves the type of this ResultSet object.
    • absolute(int row): Moves the cursor to the given row number in this ResultSet object.
    • getArray(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as an Array object.
    • getArray(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as an Array object.
    • getBigDecimal(int columnIndex, int scale): Deprecated. Use getBigDecimal(int columnIndex) or getBigDecimal(String columnLabel).
    • getBigDecimal(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as a java.math.BigDecimal with full precision.
    • getBigDecimal(String columnLabel, int scale): Deprecated. Use getBigDecimal(int columnIndex) or getBigDecimal(String columnLabel).
    • getBigDecimal(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as a java.math.BigDecimal with full precision.
    • getBinaryStream(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as a stream of uninterpreted bytes.
    • getBinaryStream(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as a stream of uninterpreted bytes.
    • getBlob(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as a Blob object.
    • getBlob(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as a Blob object.
    • getBoolean(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as a boolean.
    • getBoolean(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as a boolean.
    • getByte(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as a byte.
    • getByte(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as a byte.
    • getBytes(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as a byte array.
    • getBytes(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as a byte array.
    • getClob(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as a Clob object.
    • getClob(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as a Clob object.
    • getCharacterStream(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as a java.io.Reader object.
    • getCharacterStream(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as a java.io.Reader object.
    • getDate(int columnIndex, Calendar cal): Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Date object.
    • getDate(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Date object.
    • getDate(String columnLabel, Calendar cal): Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Date object.
    • getDate(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Date object.
    • getDouble(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as a double.
    • getDouble(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as a double.
    • getFloat(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as a float.
    • getFloat(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as a float.
    • getNClob(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as a NClob object.
    • getNClob(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as a NClob object.
    • getNCharacterStream(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as a java.io.Reader object.
    • getNCharacterStream(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as a java.io.Reader object.
    • getNString(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as a String.
    • getNString(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as a String.
    • getObject(int columnIndex, Map<String, Class<?>> map): Retrieves the value of the designated column in the current row of this ResultSet object as an object.
    • getObject(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as an object.
    • getObject(String columnLabel, Map<String, Class<?>> map): Retrieves the value of the designated column in the current row of this ResultSet object as an object.
    • getObject(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as an object.
    • getRef(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as a Ref object.
    • getRef(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as a Ref object.
    • getRowId(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as a RowId object.
    • getRowId(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as a RowId object.
    • getSQLXML(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as a SQLXML object.
    • getSQLXML(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as a SQLXML object.
    • getShort(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as a short.
    • getShort(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as a short.
    • getString(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as a String.
    • getString(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as a String.
    • getTime(int columnIndex, Calendar cal): Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Time object.
    • getTime(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Time object.
    • getTime(String columnLabel, Calendar cal): Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Time object.
    • getTime(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Time object.
    • getTimestamp(int columnIndex, Calendar cal): Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp object.
    • getTimestamp(int columnIndex): Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp object.
    • getTimestamp(String columnLabel, Calendar cal): Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp object.
    • getTimestamp(String columnLabel): Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp object.
    • isAfterLast(): Indicates whether the cursor is positioned after the last row in this ResultSet object.
    • isBeforeFirst(): Indicates whether the cursor is positioned before the first row in this ResultSet object.
    • isFirst(): Indicates whether the cursor is on the first row in this ResultSet object.
    • isLast(): Indicates whether the cursor is on the last row in this ResultSet object.
    • last(): Moves the cursor to the last row in this ResultSet object.
    • next(): Moves the cursor forward one row from its current position.
    • previous(): Moves the cursor backward one row from its current position.
    • moveToCurrentRow(): Moves the cursor to the current row, which is the row that was current when the call to updateRow occurred.
    • moveToInsertRow(): Moves the cursor to the insert row.
    • refreshRow(): Updates the current row with the current values in the underlying database.
    • relative(int rows): Moves the cursor a relative number of rows, either positive or negative.
    • rowDeleted(): Indicates whether the current row has been deleted.
    • rowInserted(): Indicates whether a new row has been inserted.
    • rowUpdated(): Indicates whether the current row has been updated.
    • updateArray(int columnIndex, Array x): Updates the designated column with a given Array object.
    • updateArray(String columnLabel, Array x): Updates the designated column with a given Array object.
    • updateAsciiStream(int columnIndex, InputStream x, int length): Updates the designated column with a stream of ASCII characters.
    • updateAsciiStream(int columnIndex, InputStream x, long length): Updates the designated column with a stream of ASCII characters.
    • updateAsciiStream(String columnLabel, InputStream x, int length): Updates the designated column with a stream of ASCII characters.
    • updateAsciiStream(String columnLabel, InputStream x, long length): Updates the designated column with a stream of ASCII characters.
    • updateBigDecimal(int columnIndex, BigDecimal x): Updates the designated column with a given BigDecimal object.
    • updateBigDecimal(String columnLabel, BigDecimal x): Updates the designated column with a given BigDecimal object.
    • updateBinaryStream(int columnIndex, InputStream x, int length): Updates the designated column with a stream of uninterpreted bytes.
    • updateBinaryStream(int columnIndex, InputStream x, long length): Updates the designated column with a stream of uninterpreted bytes.
    • updateBinaryStream(String columnLabel, InputStream x, int length): Updates the designated column with a stream of uninterpreted bytes.
    • updateBinaryStream(String columnLabel, InputStream x, long length): Updates the designated column with a stream of uninterpreted bytes.
    • updateBlob(int columnIndex, Blob x): Updates the designated column with a Blob object.
    • updateBlob(int columnIndex, InputStream inputStream, long length): Updates the designated column with a stream of uninterpreted bytes.
    • updateBlob(String columnLabel, Blob x): Updates the designated column with a Blob object.
    • updateBlob(String columnLabel, InputStream inputStream, long length): Updates the designated column with a stream of uninterpreted bytes.
    • updateBoolean(int columnIndex, boolean x): Updates the designated column with a given boolean value.
    • updateBoolean(String columnLabel, boolean x): Updates the designated column with a given boolean value.
    • updateByte(int columnIndex, byte x): Updates the designated column with a given byte value.
    • updateByte(String columnLabel, byte x): Updates the designated column with a given byte value.
    • updateBytes(int columnIndex, byte[] x): Updates the designated column with a given byte array.
    • updateBytes(String columnLabel, byte[] x): Updates the designated column with a given byte array.
    • updateCharacterStream(int columnIndex, Reader x, int length): Updates the designated column with a stream of Unicode characters.
    • updateCharacterStream(int columnIndex, Reader x, long length): Updates the designated column with a stream of Unicode characters.
    • updateCharacterStream(String columnLabel, Reader x, int length): Updates the designated column with a stream of Unicode characters.
    • updateCharacterStream(String columnLabel, Reader x, long length): Updates the designated column with a stream of Unicode characters.
    • updateClob(int columnIndex, Clob x): Updates the designated column with a given Clob object.
    • updateClob(int columnIndex, Reader reader, long length): Updates the designated column with a stream of Unicode characters.
    • updateClob(String columnLabel, Clob x): Updates the designated column with a given Clob object.
    • updateClob(String columnLabel, Reader reader, long length): Updates the designated column with a stream of Unicode characters.
    • updateDate(int columnIndex, Date x): Updates the designated column with a given java.sql.Date object.
    • updateDate(String columnLabel, Date x): Updates the designated column with a given java.sql.Date object.
    • updateDouble(int columnIndex, double x): Updates the designated column with a given double value.
    • updateDouble(String columnLabel, double x): Updates the designated column with a given double value.
    • updateFloat(int columnIndex, float x): Updates the designated column with a given float value.
    • updateFloat(String columnLabel, float x): Updates the designated column with a given float value.
    • updateInt(int columnIndex, int x): Updates the designated column with a given integer value.
    • updateInt(String columnLabel, int x): Updates the designated column with a given integer value.
    • updateLong(int columnIndex, long x): Updates the designated column with a given long value.
    • updateLong(String columnLabel, long x): Updates the designated column with a given long value.
    • updateNClob(int columnIndex, NClob x): Updates the designated column with a given NClob object.
    • updateNClob(int columnIndex, Reader reader, long length): Updates the designated column with a stream of Unicode characters.
    • updateNClob(String columnLabel, NClob x): Updates the designated column with a given NClob object.
    • updateNClob(String columnLabel, Reader reader, long length): Updates the designated column with a stream of Unicode characters.
    • updateNString(int columnIndex, String nString): Updates the designated column with a given String object.
    • updateNString(String columnLabel, String nString): Updates the designated column with a given String object.
    • updateNull(int columnIndex): Updates the designated column with the SQL NULL value.
    • updateNull(String columnLabel): Updates the designated column with the SQL NULL value.
    • updateObject(int columnIndex, Object x, int scale): Updates the designated column with a given object value.
    • updateObject(int columnIndex, Object x): Updates the designated column with a given object value.
    • updateObject(String columnLabel, Object x, int scale): Updates the designated column with a given object value.
    • updateObject(String columnLabel, Object x): Updates the designated column with a given object value.
    • updateRef(int columnIndex, Ref x): Updates the designated column with a given Ref object.
    • updateRef(String columnLabel, Ref x): Updates the designated column with a given Ref object.
    • updateRow(): Updates the underlying database with the current values in this ResultSet object.
    • updateRowId(int columnIndex, RowId x): Updates the designated column with a given RowId object.
    • updateRowId(String columnLabel, RowId x): Updates the designated column with a given RowId object.
    • updateSQLXML(int columnIndex, SQLXML xmlObject): Updates the designated column with a given SQLXML object.
    • updateSQLXML(String columnLabel, SQLXML xmlObject): Updates the designated column with a given SQLXML object.
    • updateShort(int columnIndex, short x): Updates the designated column with a given short value.
    • updateShort(String columnLabel, short x): Updates the designated column with a given short value.
    • updateString(int columnIndex, String x): Updates the designated column with a given String object.
    • updateString(String columnLabel, String x): Updates the designated column with a given String object.
    • updateTime(int columnIndex, Time x): Updates the designated column with a given java.sql.Time object.
    • updateTime(String columnLabel, Time x): Updates the designated column with a given java.sql.Time object.
    • updateTimestamp(int columnIndex, Timestamp x): Updates the designated column with a given java.sql.Timestamp object.
    • updateTimestamp(String columnLabel, Timestamp x): Updates the designated column with a given java.sql.Timestamp object.
    • wasNull(): Indicates whether the last column read had a value of SQL NULL.

    ResultSet Methods

    • ResultSet is a database result set, which can be manipulated and queried using its various methods. A ResultSet can be retrieved from a Statement object.
    • All methods take either a String column label or an int column index as an argument.
    • The columnLabel is the name of the column, while the columnIndex is the position of the column in the ResultSet object, starting at 1.
    • getBoolean(), getByte(), getShort(), getInt(), getLong(), getFloat(), getDouble(), getString() and getBigDecimal() can return an object of the corresponding type, if the column data type is convertible to that type.
    • getArray(), getBlob(), getClob(), getNClob(), getRef(), getRowId(), getSQLXML() and getObject() are used to retrieve columns as their respective types.
    • getDate(), getTime() and getTimestamp() can convert the column value to a java.sql.Date, java.sql.Time, or java.sql.Timestamp object, if possible.
    • getAsciiStream(), getBinaryStream(), getCharacterStream() and getNCharacterStream() retrieve data as input streams of characters or bytes.
    • getObject(String columnLabel, Class type) and getObject(int columnIndex, Class type) can convert retrieved data into the requested Java data type.
    • updateObject() is used to update the current row with a specified object.
    • updateXXX() methods allow updating a column with a specific data type.

    ResultSet Properties

    • getConcurrency() returns the concurrency mode of the ResultSet object.
    • getFetchDirection() returns the current fetch direction of the ResultSet object.
    • getFetchSize() returns the number of rows fetched from the database at a time.
    • getHoldability() returns the holdability of the ResultSet object.
    • getMetaData() retrieves the ResultSetMetaData object which contains meta information about the ResultSet columns.
    • getStatement() returns the Statement object associated with this ResultSet.
    • getType() returns the type of the ResultSet object, such as ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE.
    • afterLast() moves the cursor to the end of the ResultSet, after the last row.
    • beforeFirst() moves the cursor to the beginning of the ResultSet, before the first row.
    • first() moves the cursor to the first row of the ResultSet.
    • last() moves the cursor to the last row of the ResultSet.
    • next() moves the cursor to the next row of the ResultSet.
    • previous() moves the cursor to the previous row of the ResultSet.
    • absolute(int row) moves the cursor to the specified row number.
    • relative(int rows) moves the cursor a relative number of rows (positive or negative).
    • rowDeleted(), rowInserted() and rowUpdated() indicate if the current row has been deleted, inserted or updated.

    Others

    • close() closes the ResultSet and releases its resources.
    • cancelRowUpdates() cancels any updates made to the current row.
    • deleteRow() removes the current row.
    • insertRow() inserts the contents of the insert row into the ResultSet and the database.
    • moveToCurrentRow() moves the cursor back to its original position.
    • moveToInsertRow() moves the cursor to the insertion row, where data can be inserted.
    • refreshRow() updates the current row with its most recent data from the database table.
    • setFetchDirection(int direction) sets the fetch direction of the ResultSet object.
    • setFetchSize(int rows) sets the number of rows to be fetched at a time.
    • getCursorName() retrieves the name of the SQL cursor used by the ResultSet.
    • getWarnings() retrieves the first warning reported by the ResultSet object.
    • clearWarnings() clears all warnings reported by the ResultSet object.
    • wasNull() returns a boolean value indicating whether the previously retrieved value was null.

    Update Methods

    • updateBlob methods update a designated column (specified by column name or index) with a Blob value.
    • updateBoolean methods update a designated column with a boolean value.
    • updateByte methods update a designated column with a byte value.
    • updateBytes methods update a designated column with a byte[] value.
    • updateCharacterStream methods update a designated column with a Reader object, streaming characters. It can optionally take a length parameter to specify the number of characters to read.
    • updateClob methods update a designated column with a Clob value. It can also take a Reader object to stream characters.
    • updateDate methods update a designated column with a Date value.
    • updateDouble methods update a designated column with a double value.
    • updateFloat methods update a designated column with a float value.
    • updateInt methods update a designated column with an int value.
    • updateLong methods update a designated column with a long value.
    • updateNCharacterStream methods update a designated column with a Reader object, streaming characters in the national character set. It can optionally take a length parameter to specify the number of characters to read.
    • updateNClob methods update a designated column with an NClob value. It also accepts a Reader object for streaming characters in the national character set.
    • updateNString methods update a designated column with a String value in the national character set.
    • updateNull methods sets the designated column to a null value.
    • updateObject methods update a designated column with a generic Object value. It can also take a scaleOrLength parameter to specify the precision of the value.
    • updateRef methods update a designated column with a Ref value, representing a reference to a database object.
    • updateRow updates the underlying database with the new contents of the current row in the ResultSet.
    • updateRowId methods update a designated column with a RowId value, representing a unique identifier for a row in the database.
    • updateSQLXML methods update a designated column with a SQLXML value, representing an XML document.
    • updateShort methods update a designated column with a short value.
    • updateString methods update a column with a String value.
    • updateTime methods update a designated column with a Time value.
    • updateTimestamp methods update a designated column with a Timestamp value. It can optionally take a Calendar object for specifying a timezone.

    ResultSet Constants

    • CLOSE_CURSORS_AT_COMMIT: Indicates that open ResultSet objects will be closed when the transaction is committed.
    • CONCUR_READ_ONLY: Indicates that the ResultSet is read-only and cannot be updated.
    • CONCUR_UPDATABLE: Indicates that the ResultSet is updatable.
    • FETCH_FORWARD: Indicates that the ResultSet is processed in forward direction, from the first row to the last row.
    • FETCH_REVERSE: Indicates that the ResultSet is processed in reverse direction, from the last row to the first row.
    • FETCH_UNKNOWN: Indicates that the order of row processing is unknown.
    • HOLD_CURSORS_OVER_COMMIT: Indicates that open ResultSet objects will remain open when the transaction is committed.
    • TYPE_FORWARD_ONLY: Indicates that the cursor of the ResultSet can only move forward.
    • TYPE_SCROLL_INSENSITIVE: Indicates that the ResultSet is scrollable, but not sensitive to changes in the underlying data.
    • TYPE_SCROLL_SENSITIVE: Indicates that the ResultSet is scrollable and sensitive to changes in the underlying data.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Related Documents

    Collections1 PDF
    ResultSetFMs PDF

    Description

    This quiz covers the various implementations of Java collection interfaces including Collection, List, Deque, Queue, Set, and Blocking. Assess your understanding of methods like add, remove, and peek among others fundamental to Java collections.

    More Like This

    Use Quizgecko on...
    Browser
    Browser