List of usage examples for com.google.common.collect ImmutableList of
public static <E> ImmutableList<E> of(E e1, E e2, E e3, E e4, E e5, E e6)
From source file:unportant.gist.jep180.MemoryFootprint.java
public static void main(String[] args) { for (int count : ImmutableList.of(10, 100, 1000, 10000, 100000, 1000000)) { Collider djbCollider = Colliders.get(Colliders.DJBX31A); ImmutableList<String> strings = djbCollider.generate(count); {/*from w w w. jav a 2 s. c o m*/ HashMap<String, Object> map = new HashMap<String, Object>(); for (String s : strings) { map.put(s, s); } System.out.println(count + " djb " + GraphLayout.parseInstance(map).totalSize()); } { RandomStrings randomCollider = new RandomStrings(); strings = randomCollider.generate(count, strings.get(0).length()); HashMap<String, Object> map = new HashMap<String, Object>(); for (String s : strings) { map.put(s, s); } System.out.println(count + " rnd " + GraphLayout.parseInstance(map).totalSize()); } } }
From source file:com.axemblr.yab.cli.Main.java
public static void main(String[] args) { Cli.CliBuilder<Runnable> builder = Cli.<Runnable>builder("yab") .withDescription("YaB: Yet (another) AMI Baker").withDefaultCommand(Help.class) .withCommands(ImmutableList.of(Help.class, ListCommand.class, CreateCommand.class, CopyCommand.class, DropCommand.class, VersionCommand.class)); Cli<Runnable> parser = builder.build(); try {/*from ww w .ja v a2s. c om*/ parser.parse(args).run(); } catch (RuntimeException e) { System.err.println(e.getMessage()); System.exit(1); } }
From source file:com.cloudera.nav.sdk.examples.schema.FireCircleSchemaCreator.java
/** * We assume the directory name is the dataset container * @param args//from ww w . j a va2 s . c o m */ public static void main(String[] args) { // initialize the plugin NavigatorPlugin plugin = NavigatorPlugin.fromConfigFile(args[0]); // register models in package plugin.registerModels("com.cloudera.nav.sdk.examples.schema"); // get the HDFS source Source fs = plugin.getClient().getSourcesForType(SourceType.HDFS).iterator().next(); // specify the HDFS directory that contains the data String path = args[1]; HdfsEntity container = new HdfsEntity(path, EntityType.DIRECTORY, fs.getIdentity()); FireCircleDataset dataset = new FireCircleDataset(); dataset.setName("My Dataset"); dataset.setDataContainer(container); dataset.setFileFormat(FileFormat.CSV); // "4","4","2","","2008-07-31 00:00:00","" dataset.setFields( ImmutableList.of(new FireCircleField("col1", "integer"), new FireCircleField("col2", "integer"), new FireCircleField("col3", "integer"), new FireCircleField("col4", "string"), new FireCircleField("col5", "date"), new FireCircleField("col6", "string"))); // Write metadata ResultSet results = plugin.write(dataset); if (results.hasErrors()) { throw new RuntimeException(results.toString()); } }
From source file:com.jejking.hh.nord.app.CreateSpatialDrucksachenRepository.java
/** * Runs the main importer logic. Supply two parameters: directory where * the Neo4j database is located, directory where the serialised {@link RawDrucksache} * instances are to be found, each in its own file. * /*w w w . j av a 2 s . c o m*/ * @param args */ public static void main(String[] args) { Stopwatch stopwatch = Stopwatch.createStarted(); GraphDatabaseService graph = new GraphDatabaseFactory().newEmbeddedDatabase(args[0]); registerShutdownHook(graph); System.out.println("Started graph database after " + stopwatch.elapsed(TimeUnit.SECONDS) + " seconds"); DrucksachenGazetteerKeywordMatcherFactory matcherFactory = new DrucksachenGazetteerKeywordMatcherFactory(); ImmutableMap<String, DrucksachenGazetteerKeywordMatcher> matchersMap = matcherFactory .createKeywordMatchersFromGazetteer(graph, ImmutableList.of(GazetteerEntryTypes.NAMED_AREA, GazetteerEntryTypes.STREET, GazetteerEntryTypes.SCHOOL, GazetteerEntryTypes.HOSPITAL, GazetteerEntryTypes.CINEMA, GazetteerEntryTypes.UNIVERSITY)); ImportAndMatch importer = new ImportAndMatch(matchersMap); System.out.println("Initialised matchers after " + stopwatch.elapsed(TimeUnit.SECONDS) + " seconds"); importer.createDrucksachenIndexes(graph); System.out.println( "Created indexes for Drucksachen after " + stopwatch.elapsed(TimeUnit.SECONDS) + " seconds"); File drucksachenDirectory = new File(args[1]); importer.writeToNeo(Arrays.asList(drucksachenDirectory.listFiles()), graph); System.out.println("Completed import after " + stopwatch.elapsed(TimeUnit.SECONDS) + " seconds"); }
From source file:org.apache.druid.guice.GuiceInjectors.java
public static Collection<Module> makeDefaultStartupModules() { return ImmutableList.of(new DruidGuiceExtensions(), new JacksonModule(), new PropertiesModule(Arrays.asList("common.runtime.properties", "runtime.properties")), new ConfigModule(), new NullHandlingModule(), binder -> { binder.bind(DruidSecondaryModule.class); JsonConfigProvider.bind(binder, "druid.extensions", ExtensionsConfig.class); JsonConfigProvider.bind(binder, "druid.modules", ModulesConfig.class); });//from ww w. j ava 2s .c o m }