Skip to content

Instantly share code, notes, and snippets.

@kaspernielsen
Created August 8, 2012 16:27
Show Gist options
  • Save kaspernielsen/3296400 to your computer and use it in GitHub Desktop.
Save kaspernielsen/3296400 to your computer and use it in GitHub Desktop.
Cake getting started
import java.util.Arrays;
import org.cakeframework.big.map.BigMap;
import org.cakeframework.big.map.BigMapConfiguration;
/**
*
* @author Kasper Nielsen
*/
public class Tester {
public static void main(String[] args) {
BigMapConfiguration<String, Integer> c = BigMapConfiguration.newConfiguration(String.class, Integer.TYPE);
// c.withCodegen().addCodeWriter(System.out); //uncomment to see generated code
BigMap<String, Integer> m = c.create();
m.put("A", 1).put("B", 2).put("C", 3);
System.out.println(m.getAll(Arrays.asList("A", "C")).toMap());
System.out.println(m.entries().orderByKey().take(2).keys().toList());
System.out.println(Arrays.toString(m.values().orderDescending().to(Integer[].class)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment