Class Cast
java.lang.Object
net.imglib2.util.Cast
Utility class for type casts.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Cast
private Cast()
-
-
Method Details
-
unchecked
Performs an unchecked cast.For example this code snipped:
Can be rewritten as:@SuppressWarnings("unchecked")Img<T> image = (Img<T>) ArrayImgs.ints(100, 100);
It's possible to explicitly specify the return type:Img<T> image = Casts.unchecked( ArrayImgs.ints(100, 100) );Img<T> image = Casts.<Img<T>>unchecked( ArrayImgs.ints(100, 100) );- Throws:
ClassCastException- during runtime, if the cast is not possible.
-