guava Questions
6
Solved
Much like how an ImmutableList could be extended as such:
ImmutableList<Long> originalList = ImmutableList.of(1, 2, 3);
ImmutableList<Long> extendedList = Iterables.concat(originalList...
2
Solved
Why does Map<String, ?> test = ImmutableMap.builder().build(); fail to compile, but Map<String, ?> test = ImmutableMap.<String, Object>builder().build(); work fine?
The first cod...
5
Solved
I would like to load each line in a file into HashSet collection. Is there a simple way to do this?
Flunky asked 27/4, 2011 at 12:41
3
Solved
Given a path like /a/./b/c/../d, I would like to remove all the "current directory" indicators (i.e., period) and "parent directory" indicators (i.e., ..), giving a/b/d.
I could use File.getCanoni...
Fivefold asked 8/11, 2012 at 1:49
2
Solved
I am currently evaluating implementations between Apache StopWatch and Guava's Stopwatch and the split functionality in the former intrigued me, but I am struggling to understand what exactly it do...
Cymric asked 8/7, 2020 at 22:50
10
Solved
When the enhanced for loop (foreach loop) was added to Java, it was made to work with a target of either an array or Iterable.
for ( T item : /*T[] or Iterable<? extends T>*/ ) {
//use item...
8
Is there an effective way to convert java map values to comma separated string using guava or StringUtils?
Map<String, String> testMap = new HashMap<>();
testMap.put("key1", "val1");
t...
Schutzstaffel asked 26/12, 2013 at 16:32
8
Solved
What is the recommended way to transform a stream into a sliding window?
For instance, in Ruby you could use each_cons:
irb(main):020:0> [1,2,3,4].each_cons(2) { |x| puts x.inspect }
[1, 2]
[2, ...
Alansen asked 8/12, 2015 at 14:38
2
I'm trying to use the OpenRewrite plugin in my Java project and it requires guava.
Gradle is unable to choose between two variants because the plugin doesn't check attribute org.gradle.jvm.environm...
Nullifidian asked 14/8, 2023 at 8:39
4
Solved
This is the sample object i have
public class Dummy {
private long id;
private String name;
/**
* @return the id.
*/
public long getId() {
return id;
}
/**
* @param id the id to set.
*/...
Enchanting asked 14/3, 2013 at 17:56
7
Solved
I have an ArrayList which is filled by Objects.
My object class called Article which has two fields ;
public class Article {
private int codeArt;
private String desArt;
public Article(int aI...
9
Solved
I want to get string values of my fields (they can be type of long string or any object),
if a field is null then it should return empty string, I did this with guava;
nullToEmpty(String.valueOf(...
10
Solved
I'm looking for a implementation of java.util.Queue or something in the Google collection who behave like a Queue, but also ensure that each element of the queue is unique. (all further insertion w...
Isomerous asked 23/2, 2010 at 15:1
2
I have a dynamic feature module that depends on com.google.http-client:google-http-client-gson:1.40.1 which depends on com.google.guava:guava:30.1.1-android.
My base module uses several Androidx li...
Dodie asked 29/1, 2022 at 15:46
7
Solved
Is there a one-liner (maybe from Guava or Apache Collections) that gets a sublist from a set. Internally it should do something like this:
public <T> List<T> sublist(Set<T> set, ...
Tartarean asked 19/9, 2012 at 8:25
9
Solved
One of the dependencies declared in my project has a transitive dependency on 'com.google.guava:guava:15.0'. But my application deployed on WAS/Weblogic doesn't work due to a CDI issue which has be...
Vargo asked 9/6, 2015 at 9:44
6
Solved
I have multiple Set<String> that I need to merge into one Set<String>. How do I do this operation in Java? Note, I am using using the guava API as best as I can to help out. For example...
Jesseniajessey asked 3/12, 2014 at 4:22
9
Solved
I have a list of integer arrays. I need to find the common elements between those. What I can think of is an extension of what is listed in Common elements in two lists
Example would be
[1,3,5],
...
Allergic asked 3/3, 2013 at 8:44
2
Solved
As per my understanding, these annotations used for methods with an access modifier that allows method invocation from another class for unit testing
@VisibleForTesting - com.google.common.annotati...
Tynes asked 22/4, 2021 at 6:36
20
Solved
I want to have a map with duplicate keys.
I know there are many map implementations (Eclipse shows me about 50), so I bet there must be one that allows this. I know it's easy to write your own map...
Morsel asked 30/6, 2009 at 10:35
11
Solved
When I use implementation 'com.google.firebase:firebase-inappmessaging-display:17.2.0' in my app/build.gradle, I get this error:
Duplicate class com.google.common.util.concurrent.ListenableFuture ...
Platinotype asked 17/6, 2019 at 22:15
10
Solved
I'm trying to run small spark application and am getting the following exception:
Exception in thread "main" java.lang.IllegalAccessError: tried to access method com.google.common.base.Stopwatch.&...
Pinnacle asked 5/4, 2016 at 13:7
4
In guava, when using LoadingCache CacheLoader is called synchronously. However, my load() operation may take too long (~1 sec), I want to take a default action in case it takes too long (>200 ms) a...
1
How can the following method be written using Java Stream API?
public Map<String, String> getMap() {
Map<String, String> mapB = new HashMap<>();
for (String parameterKey : lis...
Rhine asked 17/10, 2022 at 14:4
4
Solved
I have a List<ImmutableList<T>>. I want to flatten it into a single ImmutableList<T> that is a concatenation of all the internal ImmutableLists. These lists can be very long so I ...
1 Next >
© 2022 - 2025 — McMap. All rights reserved.