| java.lang.Object org.openide.util.Union2
Union2 | abstract public class Union2 implements Cloneable,Serializable(Code) | | A union type which can contain one of two kinds of objects.
Object.equals and
Object.hashCode treat this as a container,
not identical to the contained object, but the identity is based on the contained
object. The union is serialiable if its contained object is.
Object.toString delegates to the contained object.
author: Jesse Glick since: org.openide.util 7.1 |
Method Summary | |
abstract public Union2<First, Second> | clone() | public static Union2<First, Second> | createFirst(First first) Construct a union based on the first type. | public static Union2<First, Second> | createSecond(Second second) Construct a union based on the second type. | abstract public First | first() Retrieve the union member of the first type. | abstract public boolean | hasFirst() Check if the union contains the first type. | abstract public boolean | hasSecond() Check if the union contains the second type. | abstract public Second | second() Retrieve the union member of the second type. |
createFirst | public static Union2<First, Second> createFirst(First first)(Code) | | Construct a union based on the first type.
Parameters: first - an object of the first type a union containing that object |
createSecond | public static Union2<First, Second> createSecond(Second second)(Code) | | Construct a union based on the second type.
Parameters: second - an object of the second type a union containing that object |
hasFirst | abstract public boolean hasFirst()(Code) | | Check if the union contains the first type.
true if it contains the first type, false if it contains the second type |
hasSecond | abstract public boolean hasSecond()(Code) | | Check if the union contains the second type.
true if it contains the second type, false if it contains the first type |
|
|