I have a 40MB (too big for memory in this case) list of strings that I want to do “begins with” queries on to extract matches. Anyone know of a good data structure for this? Bonus points for an existing os java implementation. I would be willing to sacrifice “begins with” to just exact matching if something already exists. A
Should I do things like this?
I’m only started learning guava. So I don’t know best practices and etc. These is code (it binding some classes and put in Order by input collection): So, should I separate it in several operations? upd what does it do? It takes collection. Sorts it. Maps each object to other one. Creates new ImmutableList and return it. Answer I think
Background color of the selected item in an uneditable JComboBox
The background color of the selected item in an uneditable JComboBox is a sort of blue: Is there any way to make this a different color, such as white, for example? Answer This should work
How to create a Multidimensional ArrayList in Java?
I’m fairly new to ArrayLists anyway but I need them for this project I’m doing so if you guys could help me I would be more than grateful! Basically, I need to create a multidemensional ArrayList to hold String values. I know how to do this with a standard array, like so public static String[][] array = {{}} but this
How can I create Java web service (jax-ws) with array or List as a parameter
I’ve got a problem with a web service which has an array or List as parameter. Here is example: When I call printList from web service client the result is always “list is empty” The same is when I use array of String. Should I use some additional annotations or something? Answer Your code is perfect, it seems you are
How can I get a resource content from a static context?
I want to read strings from an xml file before I do much of anything else like setText on widgets, so how can I do that without an activity object to call getResources() on? Answer Create a subclass of Application, for instance public class App extends Application { Set the android:name attribute of your <application> tag in the AndroidManifest.xml to
Print array without brackets and commas
I’m porting a Hangman game to Android and have met a few problems. The original Java program used the console, so now I have to somehow beautify the output so that it fits my Android layout. How do I print an array without the brackets and commas? The array contains slashes and gets replaced one-by-one when the correct letter is
“Uncompilable source code” RuntimeException in netbeans
I’m trying to help another developer who is using Netbeans. When he runs or debugs some code of his in Netbeans (6.9.1) he gets an “Uncompilable source code” RuntimeException. I’m pretty experienced in Java but am more used to IntelliJ, and haven’t used Netbeans at all. I’ve done it a bit of googling and it seems Netbeans will compile code
Why can hashCode() return the same value for different objects in Java?
A quote from the book I’m reading Head First Java: The point is that hashcodes can be the same without necessarily guaranteeing that the objects are equal, because the “hashing algorithm” used in the hashCode() method might happen to return the same value for multiple objects. Why might the hashCode() method return the same value for different objects? Does that
Java: Insert multiple rows into MySQL with PreparedStatement
I want to insert multiple rows into a MySQL table at once using Java. The number of rows is dynamic. In the past I was doing… I’d like to optimize this to use the MySQL-supported syntax: but with a PreparedStatement I don’t know of any way to do this since I don’t know beforehand how many elements array will contain.