java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;I)V with IE and Selenium through Java

This error message… java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;I)V …implies that the IEDriverServer was unable to initiate/spawn a new WebBrowsing Session i.e. InternetExplorer Browser session. Your main issue is the incompatibility between the version of the binaries you are using as follows: You have mentioned about using guava-21.0-jre.jar which is pretty ancient. Solution Solution to your question would be … Read more

Why did Spring framework deprecate the use of Guava cache?

Spring project decided to endorse a switch to Caffeine cache. Caffeine supersedes the caching support in the Google Guava library with an actively maintained Java 8+ version in standalone form. You can find the relevant issue with the decision on Spring’s tracker here: https://jira.spring.io/browse/SPR-13797 The relevant commit in spring framework github repo is: https://github.com/spring-projects/spring-framework/commit/2bf9bc312ed1721b5978f88861c29cffc9ea407c

Predicate in Java

I’m assuming you’re talking about com.google.common.base.Predicate<T> from Guava. From the API: Determines a true or false value for a given input. For example, a RegexPredicate might implement Predicate<String>, and return true for any string that matches its given regular expression. This is essentially an OOP abstraction for a boolean test. For example, you may have … Read more

builder for HashMap

There is no such thing for HashMaps, but you can create an ImmutableMap with a builder: final Map<String, Integer> m = ImmutableMap.<String, Integer>builder(). put(“a”, 1). put(“b”, 2). build(); And if you need a mutable map, you can just feed that to the HashMap constructor. final Map<String, Integer> m = Maps.newHashMap( ImmutableMap.<String, Integer>builder(). put(“a”, 1). put(“b”, … Read more

What’s the point of Guava’s Optional class

Guava team member here. Probably the single biggest disadvantage of null is that it’s not obvious what it should mean in any given context: it doesn’t have an illustrative name. It’s not always obvious that null means “no value for this parameter” — heck, as a return value, sometimes it means “error”, or even “success” … Read more

Combine multiple Collections into a single logical Collection?

With Guava, you can use Iterables.concat(Iterable<T> …), it creates a live view of all the iterables, concatenated into one (if you change the iterables, the concatenated version also changes). Then wrap the concatenated iterable with Iterables.unmodifiableIterable(Iterable<T>) (I hadn’t seen the read-only requirement earlier). From the Iterables.concat( .. ) JavaDocs: Combines multiple iterables into a single … Read more

How to shrink code – 65k method limit in dex

It looks like Google has finally implementing a workaround/fix for surpassing the 65K method limit of dex files. About the 65K Reference Limit Android application (APK) files contain executable bytecode files in the form of Dalvik Executable (DEX) files, which contain the compiled code used to run your app. The Dalvik Executable specification limits the … Read more