- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {ArrayList a =
new ArrayList<String>()
new ArrayList()
new ArrayList<Object>()
- Smart code suggestions by Codota
}
public <T, E extends Exception> T getOrElse( Class<T> klass, String key, SupplierE<T, E> els ) { Object val = props.get( key ); if( val == null ) { return els.get(); } if( !klass.isAssignableFrom( val.getClass() ) ) { throw new IllegalStateException( "niotest error: wrong class for: " + key + " expected: " + klass + " got: " + val.getClass() ); } return klass.cast( val ); }
public static <T,X extends Exception> T _orElseGet( @Nullable T t, SupplierE<T,X> supp) { if( t == null ) { return supp._get(); } return t; }
public Object read( FileAttributeView view, String attiName ) { checkViewType( view ); return reads.getOrThrow( attiName, new IllegalArgumentException( "attribute " + attiName + " not in view " + getViewName() ) ) .apply( v( () -> readType.cast( viewType.cast( view ).readAttributes() ) ) ); }
default R _get() { try { return getE(); } catch( Exception e ) { throw Unchecked.u( e ); } }
/** * if the the FAV is actually a BasicFileAttributeView then there is an isLink method * if this is not already set and FAV implements LinkInfoSettable use it to add this link info */ @SuppressWarnings( "PMD.CollapsibleIfStatements" ) private <V extends FileAttributeView> V addIsLinkIfPossible( Class<V> type, V fav ) { if( BasicFileAttributeView.class.isAssignableFrom( type ) ) { if( (! v( () -> BasicFileAttributeView.class.cast( fav ).readAttributes()).isSymbolicLink() )) { if( !( fav instanceof LinkInfoSettable ) ) { throw new UnsupportedOperationException( "the attribute view need to implement LinkInfoSettable in order to make SymLinks work" ); } ( (LinkInfoSettable) ( fav ) ).setLink(); } } return fav; }
static <T, E extends Exception> T v( SupplierE<T, E> f ) { return _nn( f.get() ); }
@Override default @Nullable R get() { return _get(); }
@Override public <A extends BasicFileAttributes> A getReadAttributes( Class<A> read, FileAttributeView fav ) { checkViewType( fav ); checkReadType( read ); return read.cast( v( () -> viewType.cast( fav ).readAttributes() ) ); }
public static <T, E extends Exception> T u( SupplierE<T, E> f ) { return _nn(f.get()); }
public static <T, X extends Throwable, E extends Exception> T _orElseExpectedThrow( @Nullable T t, SupplierE<X, E> exceptionSupplier ) { if( t == null ) { throw Unchecked.u( exceptionSupplier._get() ); } return t; }
public static <T, X extends Throwable, E extends Exception> T _orElseThrow( @Nullable T t, SupplierE<X, E> exceptionSupplier ) { if( t == null ) { logger.warn( "value is null " + getProblemMethod() ); throw Unchecked.u( exceptionSupplier._get() ); } return t; }