Java 8 AbstractMap.SimpleImmutableEntry - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 AbstractMap.SimpleImmutableEntry class.

This code example shows how to use the following methods:
    /** 
     * @tests serialization/deserialization compatibility with RI. 
     */ 
    @SuppressWarnings({ "unchecked", "boxing" }) 
    public void testSerializationCompatibility_SimpleImmutableEntry() throws Exception { 
        SimpleImmutableEntry e = new AbstractMap.SimpleImmutableEntry<Integer, String>(1, "test");        
        if (!(SerializationTester.readObject(e, "serialization/java/util/AbstractMapTest_SimpleImmutableEntry.golden.ser") instanceof SimpleImmutableEntry)){
            fail("should be SimpleImmutableEntry");
        } 
        SerializationTester.assertCompabilityEquals(e, "serialization/java/util/AbstractMapTest_SimpleImmutableEntry.golden.ser");        
    } 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
   * The Mapper class that given a row number, will generate the appropriate output line. 
   */ 
  public static class TTFMapper extends Mapper<Key,Value,NullWritable,Text> {
    @Override 
    public void map(Key row, Value data, Context context) throws IOException, InterruptedException {
      Map.Entry<Key,Value> entry = new SimpleImmutableEntry<Key,Value>(row, data);
      context.write(NullWritable.get(), new Text(DefaultFormatter.formatEntry(entry, false)));
      context.setStatus("Outputed Value"); 
    } 
  } 
 
  @Override 
  public int run(String[] args) throws IOException, InterruptedException, ClassNotFoundException, AccumuloSecurityException {
    Job job = JobUtil.getJob(getConf());
    job.setJobName(this.getClass().getSimpleName() + "_" + System.currentTimeMillis());
    job.setJarByClass(this.getClass());
    Opts opts = new Opts();
    opts.parseArgs(getClass().getName(), args);
 
    job.setInputFormatClass(AccumuloInputFormat.class);
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
  public String toString(String prefix, String separator, String suffix) {
    return prefix + first + separator + second + suffix;
  } 
 
  public Entry<A,B> toMapEntry() {
    return new SimpleImmutableEntry<A,B>(getFirst(), getSecond());
  } 
 
  public Pair<B,A> swap() { 
    return new Pair<B,A>(getSecond(), getFirst()); 
  } 
 
  public static <K2,V2,K1 extends K2,V1 extends V2> Pair<K2,V2> fromEntry(Entry<K1,V1> entry) {
    return new Pair<K2,V2>(entry.getKey(), entry.getValue());
  } 
 
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        Mutation m = new Mutation("row");
        m.put(b("a"), b("a"), data);
        Key key = new Key(b("row"), b("a"), b("b"), b(), 0, false);
        Value value = new Value(data);
        serializer.setMapping(COLUMN_NAME, "a", "b");
        serializer.deserialize(new SimpleImmutableEntry<>(key, value));
    } 
 
    protected static byte[] b(String str)
    { 
        return str.getBytes(UTF_8);
    } 
 
    protected static byte[] b() 
    { 
        return new byte[0]; 
    } 
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 
		DriverManager.registerDriver(driver);
		try 
		{ 
			String url1 = "jdbc:mock:db1";
			Map.Entry<String, String> property1 = new SimpleImmutableEntry<>("name", "value1");
			String url2 = "jdbc:mock:db2";
			Map.Entry<String, String> property2 = new SimpleImmutableEntry<>("name", "value2");
			DatabaseClusterConfiguration<Driver, DriverDatabase> configuration = createConfiguration(new DriverDatabaseClusterConfigurationBuilder(), url1, url2, property1, property2);
	 
			DriverDatabase db1 = configuration.getDatabaseMap().get("db1");
			assertSame(driver, db1.getConnectionSource());
			assertEquals(url1, db1.getLocation());
			assertEquals("value1", db1.getProperties().getProperty("name"));
			DriverDatabase db2 = configuration.getDatabaseMap().get("db2");
			assertSame(driver, db2.getConnectionSource());
			assertEquals(url2, db2.getLocation());
			assertEquals("value2", db2.getProperties().getProperty("name"));
		} 
		finally 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
               ((!max) && (heap.peek().getValue() > value))) {
      SimpleImmutableEntry<T,Double> pair;
      pair = heap.peek();
	    if (allowDuplicates) {
        heap.remove(pair);
        heap.add(new SimpleImmutableEntry<T,Double>(key, value));
	    } else { 
        if (! contents.containsKey(key)) {
          contents.remove(pair.getKey());
          contents.put(key,true);
          heap.remove(pair);
          heap.add(new SimpleImmutableEntry<T,Double>(key, value));
        } 
	    } 
    } 
  } 
     
  /** 
     Returns k-best entries, sorted conditioned on this.max == true or false 
  */ 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        return this;
    } 
     
    public RequestHandler withHeader(String name, String value) {
         
        headers.add(new SimpleImmutableEntry<String, String>(name, value));
        return this;
    } 
     
    public RequestHandler after(long delay, TimeUnit delayUnit) {
         
        this.delay = delay;
        this.delayUnit = delayUnit;
        return this;
    } 
     
    public RequestHandler every(long period, TimeUnit periodUnit) {
         
        this.period = period;
        this.periodUnit = periodUnit;
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
     * @param value 
     *            the value 
     * @return a Map.Entry object with the given key and value 
     */ 
    public static <K, V> Entry<K, V> entry(final K key, final V value) {
        return new SimpleImmutableEntry<K, V>(key, value);
    } 
 
    /** 
     * Creates a Set out of the given keys 
     *  
     * @param <K> the key type 
     * @param keys 
     *            the keys 
     * @return a Set containing the given keys 
     */ 
    @SafeVarargs 
    public static <K> Set<K> set(final K... keys) {
        return new LinkedHashSet<K>(Arrays.asList(keys));
    } 
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Java 8 AbstractMap.SimpleImmutableEntry Methods: