Class Monitors

All Implemented Interfaces:
Iterable<Monitor<?>>

public class Monitors extends Many<Monitor<?>>
Collection class holding a set of Monitor instances.
  • Constructor Details

    • Monitors

      public Monitors()
      Default constructor.
  • Method Details

    • add

      public Monitors add(Monitor<?> monitor)
      Description copied from class: Some
      This method allows the given 'entity' to be added to the current collection.
      Overrides:
      add in class Many<Monitor<?>>
      Parameters:
      monitor - holds the entity to add to this collection
      Returns:
      a handle to self to allow chaining
    • find

      public Monitor<?> find(Object key)
      Searches this collection for a Monitor whose key matches the given 'key' value. Returns the first matching Monitor on match, or null on no match.
      Parameters:
      key - holds the key to search for (can be null)
      Returns:
      either the first Monitor matching the given 'key', or null on no match
    • find

      public Monitor<?> find(Object key, Maybe empty)
      Description copied from class: Many
      Searches this collection for an element whose key matches the given 'key' value. Returns the first matching element on match, or the given 'empty' instance on no match.

      As an implementation note, this class is backed by a List. Therefore the 'find()' and 'findAll()' methods complete in O(n) time.

      See also the related 'Some' class which is backed by a Map and whose 'find()' and 'findAll()' methods complete in O(1) time - but cannot contain duplicate keys.

      See also the 'allowNull()' method.
      Overrides:
      find in class Many<Monitor<?>>
      Parameters:
      key - holds the key to search for (can be null)
      empty - holds the empty instance which will be returned on no match (must not be null unless the 'allowNull()' method has previously been called)
      Returns:
      either the first element matching the given 'key', or the specified 'empty' instance on no match or if 'key' is null