The Guava project is a set of Java core libraries. They include collections, caching, primitives support, concurrency libraries, common annotations, string processing, I/O etc.

learn more… | top users | synonyms

5
votes
1answer
41 views

Multi-threaded bitcoin vanity address generator written in Java

The application leverages the bitcoinj library to generate a vanity bitcoin address. A vanity address is simply a bitcoin address that contains a personalized string. I would like some critical ...
6
votes
1answer
67 views

Efficient top k words using MultiMap (Google Guava ext lib JAR)

Basic algorithm: Open document/huge text file Use Map and List to separate the words. \$O(K)\$ time complexity (TC) ...
7
votes
1answer
71 views

Designing yet another coffee machine, Lombok style

After reading Designing a coffee machine, I decided to implement the same problem as an exercise to get to know Guava and Lombok. I used the problem statement from the given question: Design ...
5
votes
2answers
44 views

BitSet wrapper to act as a sieve abstraction

This is a BitSet wrapper class to act as a Sieve abstraction for a prime calculator. Review for performance and Java/Java 8/Guava best practices. ...
0
votes
0answers
25 views

Wavefront-Reader (.obj) in Java - Part 2

I want to implement a Wavefront-Reader, and this is part II of the stuff. If you want to take a look at part I go here. Like in part I - I use: Spring for dependency-injection AutoValue classes ...
3
votes
0answers
30 views

Wavefront-Reader (.obj) in Java - Part 1

I want to implement a wavefront-reader in Java. Therefore I've created some classes to extract a Vector3f and Vector2f (I use ...
3
votes
2answers
96 views

Checking if an element sastifying a condition in a list comes before another of a different condition

This is for Java 6 and uses Guava. It's a little ugly and I'm worried I missed some obvious way to do it a lot better. If there is more than one element satisfying either condition I am saying it's ...
3
votes
1answer
85 views

Functionality for automatic retry after exception

I have made the following system to automatically retry network calls if some exception is thrown. (Earlier posted on stackOverFlow, solution inspired by what @Boris answered) ...
4
votes
1answer
218 views

Receiving a JSON string response from a URL

I am using RestTemplate as my HttpClient to execute a URL while the server will return a JSON string as the response. The ...
6
votes
1answer
258 views

Calling other machines from the LinkedList if one is blocked or down

This is a follow on to : Simplifying asynchronous "executeAsync" method along with "onFailure" callback. I am using AsyncRestTemplate as my ...
2
votes
2answers
73 views

Writing an API for checked subtraction

I have to write an API for checked subtraction where the input minuend can be < 0 but subtrahend can't be < 0. I think I've covered all the cases of underflow and overflow. With given conditions ...
4
votes
1answer
147 views

Logging using function as decorator in Guava

I needed to add a logger into my flow based on FluentIterable from the Guava library. I have a lot of functions and in some cases I would like to add logging when ...
10
votes
2answers
2k views

Efficient way of sorting a List based on multiple properties using Google Guava

I'm using Google Guava 17.0 library. I have a class named AroundBust containing only two properties id of type ...
10
votes
2answers
348 views

Twitter Streaming Client - Round#2

I've been experimenting with the Twitter Streaming API and would like some critical feedback. Specifically code correctness, code smells, overall structure, and my usage of collections and queues. ...
10
votes
3answers
250 views

Solve the game “Flux”

The Program I wrote this program as an answer to a question I thought of for Programming Puzzles and Code Golf. To avoid cross-posting, I will only summarize the requirements: Solve a game in a 3x4 ...
2
votes
1answer
89 views

Decoding big text input: potential concurrency bugs?

The code here will be directly pasted from this project. Quick summary: it is related to a Stack Overflow question. So, basically, all the code below aims to implement ...
8
votes
1answer
261 views

Cache<Long, BlockingDeque<Peer>> combined with Striped<ReadWriteLock>: is it thread-safe

I've implemented PeersContainer class with all operations that I need. I need something like multimap in concurrent environment, moreover I need remove entities ...
5
votes
1answer
133 views

One-line initialisation for a constant list with all entries except one from another list

I'm looking to simplify the initialisation of the second constant, preferably to just one line. Any ideas? Anything from Guava or JDK (up to 1.6) is ok to use. ...
4
votes
2answers
91 views

Simplify finding indices of all instances of certain characters in a string

I have a string util method for finding potential "wrapping points" in a string. For example, if " " and "-" are considered ...
5
votes
1answer
1k views

Better code for converting a char to its UTF-8 percent encoding representation?

This is working code for a URI template (RFC 6570) implementation; when the character to render is not within a specific character set, it is needed to grab the UTF-8 representation of that character ...
6
votes
2answers
361 views

Helper class to memoize DateFormats application-wide

Premise Consider the following method: static String formatMyDate(Date date) { return new SimpleDateFormat("yyyy-MM-dd").format(date); } It's often ...
6
votes
1answer
914 views

Ability to forget the memoized supplier value

Guava has a feature request which is asking to provide the ability to forget memoized value on a given supplier. On top on that I needed another functionality where if during the calculation of ...
1
vote
2answers
311 views

At most one LocalDate per month in a list

I'm implementing argument check in a method where one parameter is a List of LocalDate objects (from Joda-Time). I want to make ...