Interface CloseableNamingEnumeration<T>

All Superinterfaces:
AutoCloseable, Enumeration<T>, NamingCloseable, NamingEnumeration<T>

public interface CloseableNamingEnumeration<T> extends NamingEnumeration<T>, NamingCloseable
A naming enumeration which works with try-with-resources.
Author:
David M. Lloyd
  • Field Details

  • Method Details

    • close

      void close() throws NamingException
      Close the enumeration.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface NamingCloseable
      Specified by:
      close in interface NamingEnumeration<T>
      Throws:
      NamingException - if closing the enumeration failed for some reason
    • fromIterable

      static <T> CloseableNamingEnumeration<T> fromIterable(Iterable<T> iterable)
      Create a naming enumeration from an iterable collection.
      Type Parameters:
      T - the element type
      Parameters:
      iterable - the iterable
      Returns:
      the enumeration
    • fromIterator

      static <T> CloseableNamingEnumeration<T> fromIterator(Iterator<T> iterator)
      Create a naming enumeration from a collection iterator.
      Type Parameters:
      T - the element type
      Parameters:
      iterator - the iterator
      Returns:
      the enumeration
    • fromEnumeration

      static <T> CloseableNamingEnumeration<T> fromEnumeration(Enumeration<T> enumeration)
      Create a naming enumeration from a collection enumeration.
      Type Parameters:
      T - the element type
      Parameters:
      enumeration - the enumeration
      Returns:
      the enumeration
    • fromEnumeration

      static <T> CloseableNamingEnumeration<T> fromEnumeration(NamingEnumeration<T> enumeration)
      Create a closeable naming enumeration from a naming enumeration.
      Type Parameters:
      T - the element type
      Parameters:
      enumeration - the enumeration
      Returns:
      the enumeration
    • empty

      static <T> CloseableNamingEnumeration<T> empty()