public final class Cast extends Object
Modifier and Type | Method and Description |
---|---|
static <T> T |
unchecked(Object value)
Performs an unchecked cast.
|
public static <T> T unchecked(Object value)
For example this code snipped:
Can be rewritten as:@SuppressWarnings("unchecked")
Img<T> image = (Img<T>) ArrayImgs.ints(100, 100);
Img<T> image = Casts.unchecked( ArrayImgs.ints(100, 100) );
It's possible to explicitly specify the return type:
Img<T> image = Casts.<Img<T>>unchecked( ArrayImgs.ints(100, 100) );
ClassCastException
- during runtime, if the cast is not possible.Copyright © 2015–2022 ImgLib2. All rights reserved.