Top "Guava" questions

Google's Core Java Library for Java and Android development.

What is an efficient and elegant way to add a single element to an immutable set?

I have an immutable set (cast as a Set<Integer>) that potentially contains many elements. I need a …

java guava
How do I create an empty Guava ImmutableList?

I can create a Guava ImmutableList with the of method, and will get the correct generic type based on the …

java generics guava immutablelist
Should I use Java8/Guava Optional for every method that may return null?

Optional is used to represent nullable object, Some uses of this class include As a method return type, as an …

java guava optional java-8
Atomically incrementing counters stored in ConcurrentHashMap

I would like to collect some metrics from various places in a web app. To keep it simple, all these …

java multithreading concurrency guava concurrenthashmap
When to use an Event Bus?

I'm designing the backend for a new Java web app and am trying to decide whether or not to use …

java guava event-bus
guava cache vs ehcache benchmark

I'm trying to decide which of these two to use in my project: guava cache or ehcache. Looking for a …

java benchmarking guava ehcache
Convert java Map to custom key=value string

I have TreeMap<String,String> which I need to convert to URI-like string and then back to Map. …

java map guava apache-commons
Text file into Java List<String> using Commons or Guava

What is the most elegant way to put each line of text (from the text file) into LinkedList (as String …

java file text guava apache-commons
Is there java.util.concurrent equivalent for WeakHashMap?

Can the following piece of code be rewritten w/o using Collections.synchronizedMap() yet maintaining correctness at concurrency? Collections.synchronizedMap(…

java collections guava java.util.concurrent weakhashmap