/** * Creates a list of service definitions. * * @param endpointDefinitions vararg array of service definitions * @return list of service definitions */ public static List<EndpointDefinition> serviceDefinitions(final EndpointDefinition... endpointDefinitions) { return Lists.list(endpointDefinitions); }
@Override public List<NodeHealthStat> loadNodes() { logger.info("HealthService::loadNodes() called"); return Lists.deepCopy(this.serviceHealthStatMap.values()); }
list = Lists.slc(list, 1); //remove the callback from the args bc the callback is called
public static <T> T atIndex( List<T> list, final int index ) { return idx(list, index); }
/** * Clones each list item into a new instance with copied fields. * It is like doing a clone operation. * * If the passed list is a LinkedList then the returned list will be a * LinkedList. * * If the passed list is a CopyOnWriteArrayList then the returned list will * be a CopyOnWriteArrayList list. * * All other lists become ArrayList. * * @param list list to clone * @param <V> generics * @return new list */ public static <V> List<V> deepCopy( List<V> list ) { if ( list instanceof LinkedList ) { return deepCopyToList( list, new LinkedList<V>( ) ); } else if ( list instanceof CopyOnWriteArrayList ) { return deepCopyToList( list, new CopyOnWriteArrayList<V>( )); } else { return deepCopy( (Collection)list); } }
public static <T> List<T> mapBy(Class<T> cls, Collection<?> objects, Object function) { return (List<T>) mapBy(objects, function); }
public static int lengthOf( List<?> list ) { return len (list); }
public static <T> Map idxMap( List<T> list, final int index ) { return (Map) idx(list, index); }
/** * Clones each list item into a new instance with copied fields. * It is like doing a clone operation. * * If the passed list is a LinkedList then the returned list will be a * LinkedList. * * If the passed list is a CopyOnWriteArrayList then the returned list will * be a CopyOnWriteArrayList list. * * All other lists become ArrayList. * * @param list list to clone * @param <V> generics * @return new list */ public static <V> List<V> deepCopy( List<V> list ) { if ( list instanceof LinkedList ) { return deepCopyToList( list, new LinkedList<V>( ) ); } else if ( list instanceof CopyOnWriteArrayList ) { return deepCopyToList( list, new CopyOnWriteArrayList<V>( )); } else { return deepCopy( (Collection)list); } }
public static <T> List<T> mapBy(Class<T> cls, Collection<?> objects, Object function) { return (List<T>) mapBy(objects, function); }
public static int lengthOf( List<?> list ) { return len (list); }
public static List<RequestMethod> requestMethods(final RequestMethod... methods) { return Lists.list(methods); }
public static <V> List<V> slcEnd( List<V> list, int endIndex ) { return slc( list, 0, endIndex ); }
public static <T> Map idxMap( List<T> list, final int index ) { return (Map) idx(list, index); }
@Override public List<NodeHealthStat> loadNodes() { logger.info("HealthService::loadNodes() called"); return Lists.deepCopy(this.serviceHealthStatMap.values()); }
public static List<Path> path() { final String[] paths = StringScanner.splitByDelimiters(System.getenv().get("PATH"), ":;"); return Lists.mapBy(paths, IO.convertToPathFunction); }
public static String readFromClasspath( Class<?> clazz, String location ) { List<String> resources = resources( clazz, location ); if ( len( resources ) > 0 ) { try { return IO.read(Files.newBufferedReader(path(resources.get(0)), IO.DEFAULT_CHARSET)); } catch ( IOException e ) { return Exceptions.handle( String.class, "unable to read classpath resource " + location, e ); } } else { return null; } }