Package com.db4o

Interface ObjectSet<T>

  • All Superinterfaces:
    java.util.Collection<T>, java.lang.Iterable<T>, java.util.List<T>
    All Known Subinterfaces:
    ExtObjectSet
    All Known Implementing Classes:
    ObjectSetFacade

    public interface ObjectSet<T>
    extends java.util.List<T>, java.lang.Iterable<T>
    An ObjectSet is a representation for a set of objects returned by a query.

    ObjectSet extends the list interface. It is recommended to never reference ObjectSet directly in code but to use the list interface instead.

    Note that the underlying ObjectContainer of an ObjectSet needs to remain open as long as an ObjectSet is used. This is necessary for lazy instantiation. The objects in an ObjectSet are only instantiated when they are actually being used by the application. In case you want to use a query result after the object container has been closed, you need to copy the result set.
    See Also:
    for extended functionality.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      ExtObjectSet ext()
      Returns an ObjectSet with extended functionality.
      boolean hasNext()
      Returns true if the ObjectSet has more elements.
      T next()
      Returns the next object in the ObjectSet.
      void reset()
      Resets the ObjectSet cursor before the first element.
      int size()
      Returns the number of elements in the ObjectSet.
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, sort, spliterator, subList, toArray, toArray
    • Method Detail

      • ext

        ExtObjectSet ext()
        Returns an ObjectSet with extended functionality.

        Every ObjectSet that db4o provides can be casted to an ExtObjectSet. This method is supplied for your convenience to work without a cast.

        The ObjectSet functionality is split to two interfaces to allow newcomers to focus on the essential methods.
      • hasNext

        boolean hasNext()
        Returns true if the ObjectSet has more elements.
        Returns:
        boolean - true if the ObjectSet has more elements.
      • next

        T next()
        Returns the next object in the ObjectSet.

        Before returning the object, next() triggers automatic activation of the object with the respective global or class specific setting.

        Returns:
        the next object in the ObjectSet.
      • reset

        void reset()
        Resets the ObjectSet cursor before the first element. A subsequent call to next() will return the first element.
      • size

        int size()
        Returns the number of elements in the ObjectSet.
        Specified by:
        size in interface java.util.Collection<T>
        Specified by:
        size in interface java.util.List<T>
        Returns:
        the number of elements in the ObjectSet.