Package it.unimi.dsi.lang
Class FlyweightPrototypes
- java.lang.Object
-
- it.unimi.dsi.lang.FlyweightPrototypes
-
public class FlyweightPrototypes extends java.lang.Object
A class providing static methods and objects that do useful things with flyweight protoypes.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
FlyweightPrototypes()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends FlyweightPrototype<T>>
Tcopy(T prototype)
Creates a flyweight copy of the given object, or returnsnull
if the given object isnull
.static <T extends FlyweightPrototype<T>>
T[]copy(T[] prototype)
Creates a flyweight copy of an array of flyweight prototypes.
-
-
-
Method Detail
-
copy
public static <T extends FlyweightPrototype<T>> T[] copy(T[] prototype)
Creates a flyweight copy of an array of flyweight prototypes.- Type Parameters:
T
- the type ofFlyweightPrototype
you want to copy, that is, the type of the elements ofprototype
.- Parameters:
prototype
- an array of prototypes.- Returns:
- a flyweight copy of
prototype
, obtained by invokingFlyweightPrototype.copy()
on each element.
-
copy
public static <T extends FlyweightPrototype<T>> T copy(T prototype)
Creates a flyweight copy of the given object, or returnsnull
if the given object isnull
.- Type Parameters:
T
- the type ofFlyweightPrototype
you want to copy, that is, the type ofprototype
.- Parameters:
prototype
- a prototype to be copied, ornull
.- Returns:
null
, ifprototype
isnull
; otherwise,a flyweight copy ofprototype
.
-
-