Search Results

Search found 7 results on 1 pages for 'bimap'.

Page 1/1 | 1 

  • To instantiate BiMap Of google-collections in Java

    - by Masi
    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, Integer>.

    Read the article

  • Essence of BiMap in Google collections

    - by littleEinstein
    I am still quite puzzled at the BiMap in Google collections/Guava. It was claimed that The two bimaps are backed by the same data; any changes to one will appear in the other. I browsed through the source code, and I found the use of delegate in ForwardingMap. But in any actually subclass of StandardBiMap, I do see the data are put into both the forward and reverse map. So what is the essence, and why it claims to have saved space by keeping only one copy of the data? Is it just the actual objects are one set, but two distinct sets of references to these objects are still needed, one set maintained in forward map, and the other in reverse map? private V putInBothMaps(K key, V value, boolean force) { boolean containedKey = containsKey(key); if (containedKey && Objects.equal(value, get(key))) { return value; } if (force) { inverse().remove(value); } else if (containsValue(value)) { throw new IllegalArgumentException( "value already present: " + value); } V oldValue = super.put(key, value); updateInverseMap(key, containedKey, oldValue, value); return oldValue; }

    Read the article

  • Javacing code in terminal havivng a Jar in CLASSPATH

    - by Masi
    How can you javac the code in terminal by using google-collections in CLASSPATH? Example of code trying to javac in terminal (works in Eclipse) import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; public class Locate { ... BiMap<MyFile, Integer> rankingToResult = HashBiMap.create(); ... } Javacing in terminaling src 288 % javac Locate.java Locate.java:14: package com.google.common.collect does not exist import com.google.common.collect.BiMap; ^ Locate.java:15: package com.google.common.collect does not exist import com.google.common.collect.HashBiMap; ^ Locate.java:153: cannot find symbol symbol : class BiMap location: class Locate BiMap<MyFile, Integer> rankingToResult = HashBiMap.create(); ^ Locate.java:153: cannot find symbol symbol : variable HashBiMap location: class Locate BiMap<MyFile, Integer> rankingToResult = HashBiMap.create(); ^ 4 errors My CLASSPATH src 289 % echo $CLASSPATH /u/1/bin/javaLibraries/google-collect-1.0.jar

    Read the article

  • Compiling Java code in terminal having a Jar in CLASSPATH

    - by Masi
    How can you compile the code using javac in a terminal by using google-collections in CLASSPATH? Example of code trying to compile using javac in a terminal (works in Eclipse) import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; public class Locate { ... BiMap<MyFile, Integer> rankingToResult = HashBiMap.create(); ... } Compiling in terminal src 288 % javac Locate.java Locate.java:14: package com.google.common.collect does not exist import com.google.common.collect.BiMap; ^ Locate.java:15: package com.google.common.collect does not exist import com.google.common.collect.HashBiMap; ^ Locate.java:153: cannot find symbol symbol : class BiMap location: class Locate BiMap<MyFile, Integer> rankingToResult = HashBiMap.create(); ^ Locate.java:153: cannot find symbol symbol : variable HashBiMap location: class Locate BiMap<MyFile, Integer> rankingToResult = HashBiMap.create(); ^ 4 errors My CLASSPATH src 289 % echo $CLASSPATH /u/1/bin/javaLibraries/google-collect-1.0.jar

    Read the article

  • Compiling Java code in terminal having a Jar in CLASSPATH

    - by Masi
    How can you compile the code using javac in a terminal by using google-collections in CLASSPATH? Example of code trying to compile using javac in a terminal (works in Eclipse) import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; public class Locate { ... BiMap<MyFile, Integer> rankingToResult = HashBiMap.create(); ... } Compiling in terminal src 288 % javac Locate.java Locate.java:14: package com.google.common.collect does not exist import com.google.common.collect.BiMap; ^ Locate.java:15: package com.google.common.collect does not exist import com.google.common.collect.HashBiMap; ^ Locate.java:153: cannot find symbol symbol : class BiMap location: class Locate BiMap<MyFile, Integer> rankingToResult = HashBiMap.create(); ^ Locate.java:153: cannot find symbol symbol : variable HashBiMap location: class Locate BiMap<MyFile, Integer> rankingToResult = HashBiMap.create(); ^ 4 errors My CLASSPATH src 289 % echo $CLASSPATH /u/1/bin/javaLibraries/google-collect-1.0.jar

    Read the article

  • Google Collections sources don't compile

    - by Carl Rosenberger
    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 AbstractMultimap + 11 similar ones Name clash: The method forcePut(K, V) of type AbstractBiMap has the same erasure as forcePut(Object, Object) of type BiMap but does not override it + 2 similar ones What am I missing? I also wonder if unit tests for these collections are available to the public.

    Read the article

  • Translating 3-dimensional array reference onto 1-dimensional array

    - by user146780
    If there is an array of ar[5000] then how could I find where element [5][5][4] would be if this was a 3 dimensional array? Thanks I'm mapping pixels: imagine a bimap of [768 * 1024 * 4] where would pixel [5][5][4] be? I want to make this: static GLubyte checkImage[checkImageHeight][checkImageWidth][4]; static GLuint texName; bool itt; void makeCheckImage(void) { Bitmap *b = new Bitmap(L"c:/boo.png"); int i, j, c; Color cul; for (i = 0; i < checkImageHeight; i++) { for (j = 0; j < checkImageWidth; j++) { b->GetPixel(j,i,&cul); checkImage[i][j][0] = (GLubyte) cul.GetR(); checkImage[i][j][1] = (GLubyte) cul.GetG(); checkImage[i][j][2] = (GLubyte) cul.GetB(); checkImage[i][j][3] = (GLubyte) cul.GetA(); } } delete(b); } work without making a multidimensional array. width = 512, height = 1024....

    Read the article

1