Skip navigation links

Oracle® Information Rights Management Server Java API Reference
11g Release 1 (11.1.1)

E12907-02


oracle.irm.engine.core.time
Class TimePeriodCollectionFactory

java.lang.Object
  extended by oracle.irm.engine.core.time.TimePeriodCollectionFactory


public final class TimePeriodCollectionFactory
extends Object

Time Period collection factory and utilities. This class provides methods for creating new instances of TimePeriod collections as well as providing a number of collection based utility methods and fields. These methods are provided mainly for convenience and to provide a consistent way to create Time Period collections. Methods that take collection parameters make no assumptions about what collection implementation is used, so the use of these factory style methods is at the developers discretion.


Field Summary
static Collection<TimePeriod> EMPTY_TIME_PERIODS
          An empty Time Period collection.

 

Method Summary
static Collection<TimePeriod> copyTimePeriods(Collection<TimePeriod> collection)
          Create a shallow copy of a Time Period collection.
static Collection<TimePeriod> createTimePeriods(int capacity)
          Create an empty Time Period collection with a capacity specified.
static Collection<TimePeriod> createTimePeriods(TimePeriod... elements)
          Create a Time Period collection containing zero or more elements.
static Set<TimePeriod> timePeriodsAsSet(Collection<TimePeriod> collection)
          Create a set of Time Period elements from a collection.
static Collection<TimePeriod> unmodifiableTimePeriods(Collection<TimePeriod> value)
          Create an immutable shallow copy of a Time Period collection.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

EMPTY_TIME_PERIODS

public static final Collection<TimePeriod> EMPTY_TIME_PERIODS
An empty Time Period collection. This empty collection is immutable. This field is useful if a method requires a collection argument but the caller wants to supply an empty collection. Using this field value rather than passing null can aid code clarity.

Method Detail

createTimePeriods

public static Collection<TimePeriod> createTimePeriods(TimePeriod... elements)
Create a Time Period collection containing zero or more elements. Creates a collection and adds all of the provided elements into the specified collection. This method is provided as a convenience method as it allows creation of an empty collection, a collection with one element or a collection with many elements (all in one line of code).
Parameters:
elements - The elements to add into the collection.
Returns:
The collection containing the specified elements. If no elements are provided an empty collection is returned.

createTimePeriods

public static Collection<TimePeriod> createTimePeriods(int capacity)
Create an empty Time Period collection with a capacity specified. Creates an empty collection with an initial capacity for n elements.
Parameters:
capacity - The initial collection capacity.
Returns:
The empty collection with the specified capacity.

copyTimePeriods

public static Collection<TimePeriod> copyTimePeriods(Collection<TimePeriod> collection)
Create a shallow copy of a Time Period collection. A shallow copy creates a new collection which contains the elements of the provided collection.
Parameters:
collection - The collection to copy.
Returns:
The copy of the collection. If the provided collection is null, an empty collection is returned.

timePeriodsAsSet

public static Set<TimePeriod> timePeriodsAsSet(Collection<TimePeriod> collection)
Create a set of Time Period elements from a collection. Time Period objects can be logically compared using equals. When adding Time Period objects into a set duplicates will be removed.
Parameters:
collection - The collection to copy.
Returns:
The set. If the provided collection is null, an empty set is returned.

unmodifiableTimePeriods

public static Collection<TimePeriod> unmodifiableTimePeriods(Collection<TimePeriod> value)
Create an immutable shallow copy of a Time Period collection. Time Period objects are immutable (cannot be changed once created). An immutable collection of Time Period elements can therefore be treated as immutable (neither the collection or elements can be changed once created).
Parameters:
value - The collection to copy.
Returns:
The immutable collection. If the provided collection is null, an empty collection is returned.

Skip navigation links

Oracle® Information Rights Management Server Java API Reference
11g Release 1 (11.1.1)

E12907-02


Copyright © 2010, Oracle. All rights reserved.