There are a few factory methods in Google Guava to create InputSuppliers, e.g. from a byte[]:
ByteStreams.newInputStreamSupplier(bytes);
Or from a File:
Files.newInputStreamSupplier(file);
Is there a similar way to to create an InputSupplier for a given InputStream?
That is, a way that's more concise than an anonymous class:
new...
Is google collections Joiner thread safe?
...
This is a simple problem, but I'm having problems with it...
I'm trying to use Google common collection's Objects.equal() method in a GWT client code, but I'm keep getting the error
"20:12:10.001 [ERROR] [gwt_regex] Line 39: No source code is available for type com.google.common.base.Objects; did you forget to inherit a required module...
It seems like there should be a removalAllOccuring(Collection) (or similiar) method in Multiset. A sort of analog to remove(Object,int) and removeAll(Collection). Short of that method, what is the best way to accomplish its intent. I wrote a small JUnit driver to demonstrate:
/**
* @see http://google-collections.googlecode.com/svn/t...
How can you instantiate a Bimap of Google-collections?
I know the thread.
A sample of my code
import com.google.common.collect.BiMap;
public class UserSettings {
private Map<String, Integer> wordToWordID;
UserSettings() {
this.wordToWordID = new BiMap<String. Integer>();
I get cannot instantiate the type BiMap<String, Intege...
I am getting the following compile error "The method putInstance(Class, T) in the type MutableClassToInstanceMap is not applicable for the arguments (Class, Number)" on the putInstance method call. Does anyone know what I am doing wrong?? Thanks!
public class TestMutableClassToInstanceMap {
public final MutableClassToInstanceMap<Nu...
Say there are two objects, A and B, and there is a pointer A.x --> B, and we create, say, WeakReferences to both A and B, with an associated ReferenceQueue.
Assume that both A and B become unreachable. Intuitively B cannot be considered unreachable before A is. In such a case, do we somehow get a guarantee that the respective references...
I read through the javadoc and couldn't find anything that resembles it.
...
I would like to know a few practical use-cases (if they are not related/tied to any programming language it will be better).I can associate Sets, Lists and Maps to practical use cases.
For example if you wanted a glossary of a book where terms that you want are listed alphabetically and a location/page number is the value, you would us...
Hello,
I would like use google-collection in order to save the following file in a Hash with multiple keys and values
Key1_1, Key2_1, Key3_1, data1_1, 0, 0
Key1_2, Key2_2, Key3_2, data1_2, 0, 0
Key1_3, Key2_3, Key3_3, data1_3, 0, 0
Key1_4, Key2_4, Key3_4, data1_4, 0, 0
The first three columns are the different keys and the last two in...
I'm using google-collections and trying to find the first element that satisfies Predicate if not, return me 'null'.
Unfortunately, Iterables.find and Iterators.find throws NoSuchElementException when no element is found.
Now, I am forced to do
Object found = null;
if ( Iterators.any( newIterator(...) , my_predicate )
{
found = It...
I am looking to find guava-libraries in maven repository. It looks like guava is adding more features to google-collections library.
...
Has anyone had any luck rolling a custom GWT jar for Google Collections / Guava? I've tried uncommenting the relevant ant tasks and running them, but I just get empty folders in the JAR. Can't seem to get the include rules right :-/
...
Keys are a file and a word. The file gives all words inside the file. The word gives all files having the word. I am unsure of the domain and co-domain parts. I want K to be of the type <String> and V to be of type <HashSet<FileObject>>.
public HashBiMap<K<String>,V<HashSet<FileObject>>> wordToFiles
= new HashBiMap<K<St...
The code shows compilation with the -cp trigger but not running. Apparently, it cannot find the HashMultimap. Classpath problem?
$ javac -cp google-collect-1.0.jar MultiThing.java
$ java -cp google-collect-1.0.jar MultiThing
Exception in thread "main" java.lang.NoClassDefFoundError: MultiThing
Caused by: java.lang.ClassNotFoundExcept...
I was looking for a decent implementation of a generic lazy non-modifiable list implementation to wrap my search result entries. The unmodifiable part of the task is easy as it can be achieved by Collections.unmodifiableList() so I only need to sort out the the lazy part.
Surprisingly, google-collections doesn't have anything to offer; ...
I need to define a weak reference Map, whose value is a Set. I use Google collections' MapMaker, like this:
Map<Class<? extends Object>, Set<Foo>> map = new MapMaker().weakKeys().weakValues().makeMap();
So, for Set<Foo>, can I use a normal HashSet? Or, do I have to create a weak HashSet, like this:
Collections.newSetFromMap(new WeakH...
I can't see any way to build a Predicate that uses parenthesis to control logical order. Is there one?
Say I want to do something like
Predicate <= mumble and (foo or baz)
A simple Predicates.and or a Predicates.or has no equivalent that says "foo or baz" and with mumble.
Is this possible?
...
Hi,
So I'm trying to build guava from source with maven2 but it seems to need the 'google' artifact as parent. Where is the upstream website of this artifact? (yes, I need the source, not just the artifact).
Thanks,
red
...
I just downloaded the Google Collections sources and imported them into a new Eclipse project with JDK 1.6.
They don't compile for a couple of reasons:
javax.annotation.Nullable can not be found
javax.annotation.ParametersAreNonnullByDefault can not be found
Cannot reduce the visibility of the inherited method #createCollection() from A...