List of usage examples for com.google.common.collect Maps newHashMap
public static <K, V> HashMap<K, V> newHashMap()
From source file:com.scriptability.example.polyglot.PolyglotMain.java
public static void main(String[] args) { Map<String, Object> scriptApi = Maps.newHashMap(); scriptApi.put("apiObject", new APIObject()); ScriptAbility scriptAbility = ScriptAbility.getScriptAbility(); scriptAbility.start(scriptApi);//from w w w. ja v a2 s.c om scriptAbility.fireEvent("polyglot"); scriptAbility.stop(); }
From source file:com.scriptability.example.scriptapi.ScriptAPIMain.java
public static void main(String[] args) { Map<String, Object> scriptApi = Maps.newHashMap(); scriptApi.put("apiObject", new APIObject()); ScriptAbility scriptAbility = ScriptAbility.getScriptAbility(); scriptAbility.start(scriptApi);//w ww. j a va2 s . co m scriptAbility.fireEvent("api"); scriptAbility.stop(); }
From source file:com.scriptability.example.eventcontext.EventContextMain.java
public static void main(String[] args) { ScriptAbility scriptAbility = ScriptAbility.getScriptAbility(); scriptAbility.start();//from www. j a v a 2 s. co m Map<String, String> eventContext = Maps.newHashMap(); eventContext.put("message", "This is an event context parameter"); scriptAbility.fireEvent("context", eventContext); scriptAbility.stop(); }
From source file:com.topekalabs.bigmachine.client.BGMCLI.java
public static void main(String[] args) { JCommander jCommander = new JCommander(); Map<String, Command> commandMap = Maps.newHashMap(); // Commands/*from w ww.j a v a 2 s. c o m*/ CommandLaunchBGMApp launchCommand = new CommandLaunchBGMApp(); // Add Them jCommander.addCommand(CommandLaunchBGMApp.COMMAND, launchCommand); commandMap.put(CommandLaunchBGMApp.COMMAND, (Command) launchCommand); try { jCommander.parse(args); } catch (ParameterException ex) { logger.info(ex.getMessage()); return; } Command command = commandMap.get(jCommander.getParsedCommand()); if (command == null) { jCommander.usage(); return; } command.execute(); }
From source file:org.andrewhitchcock.duwamish.example.BenchmarkSuite.java
@SuppressWarnings("unchecked") public static void main(String[] args) throws Exception { Map<Class, ArrayList<ArrayList<String>>> tests = Maps.newHashMap(); tests.put(PageRank.class, Lists.newArrayList(Lists.newArrayList("5000", "1"), Lists.newArrayList("20000", "1"), Lists.newArrayList("100000", "1"), Lists.newArrayList("250000", "1"))); tests.put(Recommendations.class, Lists.newArrayList(Lists.newArrayList("1000", "10000", "64", "1"), Lists.newArrayList("5000", "50000", "64", "1"))); //Lists.newArrayList("10000", "100000", "64", "1"))); tests.put(ShortestPath.class, Lists.newArrayList(Lists.newArrayList("5000", "1"), Lists.newArrayList("20000", "1"), Lists.newArrayList("100000", "1"), Lists.newArrayList("250000", "1"), Lists.newArrayList("500000", "1"))); for (Map.Entry<Class, ArrayList<ArrayList<String>>> entry : tests.entrySet()) { Class clazz = entry.getKey(); for (ArrayList<String> arguments : entry.getValue()) { bestOfThree(clazz, arguments); }//from w w w. j a va2 s . co m } }
From source file:pt.uminho.anote2.carrot.linkage.examples.SavingResultsToXml.java
public static void main(String[] args) throws Exception { // Let's fetch some results from MSN first final Controller controller = ControllerFactory.createSimple(); final Map<String, Object> attributes = Maps.newHashMap(); CommonAttributesDescriptor.attributeBuilder(attributes) .documents(new ArrayList<Document>(SampleDocumentData.DOCUMENTS_DATA_MINING)).query("data mining"); final ProcessingResult result = controller.process(attributes, LingoClusteringAlgorithm.class); // Now, we can serialize the entire result to XML like this result.serialize(System.out); // Optionally, we can choose whether we want to serialize documents and clusters result.serialize(System.out, false /* don't save documents */, true /* save clusters */); }
From source file:org.carrot2.examples.core.SavingResultsToXml.java
public static void main(String[] args) throws Exception { // Let's fetch some results from MSN first final Controller controller = ControllerFactory.createSimple(); final Map<String, Object> attributes = Maps.newHashMap(); CommonAttributesDescriptor.attributeBuilder(attributes) .documents(new ArrayList<Document>(SampleDocumentData.DOCUMENTS_DATA_MINING)).query("data mining"); final ProcessingResult result = controller.process(attributes, LingoClusteringAlgorithm.class); // Now, we can serialize the entire result to XML like this result.serialize(System.out); System.out.println();//from w w w .j av a 2s. c o m // Optionally, we can choose whether we want to serialize documents and clusters result.serialize(System.out, false /* don't save documents */, true /* save clusters */); }
From source file:org.carrot2.examples.core.SavingResultsToJson.java
public static void main(String[] args) throws Exception { // Let's fetch some results from MSN first final Controller controller = ControllerFactory.createSimple(); final Map<String, Object> attributes = Maps.newHashMap(); CommonAttributesDescriptor.attributeBuilder(attributes) .documents(new ArrayList<Document>(SampleDocumentData.DOCUMENTS_DATA_MINING)).query("data mining"); final ProcessingResult result = controller.process(attributes, LingoClusteringAlgorithm.class); // Now, we can serialize the entire result to XML like this result.serializeJson(new PrintWriter(System.out)); System.out.println();/* www .j av a2 s .c o m*/ // Optionally, we can provide a callback for JSON-P-style calls result.serializeJson(new PrintWriter(System.out), "loadResults", true /* indent */, false /* save documents */, true /* save clusters */); }
From source file:com.macrossx.wechat.entity.WechatButton.java
public static void main(String... s) { List<WechatButton> t = Lists.newArrayList(); WechatButton b = new WechatButton(); b.setName("a"); b.setType("b"); t.add(b);//from w w w . j a va 2s . com Map<String, List<WechatButton>> tx = Maps.newHashMap(); tx.put("button", t); System.out.println(new Gson().toJsonTree(tx)); }
From source file:com.github.lburgazzoli.sandbox.jpa.openjpa.OpenJpaMain.java
public static void main(String[] args) { EntityManagerFactory emf = null;//from ww w . java2s.c o m EntityManager em = null; try { Map<Object, Object> properties = Maps.newHashMap(); if (args.length == 1) { properties.put("openjpa.Log", args[0]); } emf = Persistence.createEntityManagerFactory("DATA_OPENJPA", properties); em = emf.createEntityManager(); em.getTransaction().begin(); em.persist(new OpenJpaItem("item_1", "desr_1")); em.getTransaction().commit(); } catch (Exception e) { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } LOGGER.warn("Exception", e); } finally { if (em != null) { em.close(); } } }