Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 134583

Java is a high-level, platform-independent, object-oriented programming language originally developed by Sun Microsystems. Java is currently owned by Oracle, which purchased Sun in 2010.

1 vote

Best Practice: What can be the hashCode() method implementation if custom field used in equa...

I would do hashCode() as follows public int hashCode() { String str = this.firstName + " " + this.lastName; return str.hashCode(); } That would satisfy the requirements for hashCode() equal obje …
InformedA's user avatar
  • 3,021
0 votes

Constructor vs setter validations

But the most compelling reason is when you use the class as data entity, those getters and setters might be used by java bean container (EJB, Spring), JPA, XML marshaller and unmarshaller. …
InformedA's user avatar
  • 3,021
0 votes

Java best practice Interface - subclasses and constants

Why not in a static Constant class? I have seen popular framework like SWT putting lot of constants in a constant class if the usage is widespread. And even in the case where the usage is not widespre …
InformedA's user avatar
  • 3,021
0 votes

I don't know how to understand the Wildcard type in Java

super Manager> the read methods in Pair<> returns generic java Object (ie not type safe for read, the compiler kind of discourages reading in this case) I think seeing it as read and write like this …
InformedA's user avatar
  • 3,021
0 votes

Nested maps vs. combined keys

Both options are not good in my opinion. Say what if the business logic changes again so that you have another subtype? What I suggest you do is the following: Use a surrogate key for a table call …
InformedA's user avatar
  • 3,021
1 vote
Accepted

Sortable listview using SQLite

From what you have given here, I would make a few addition assumptions and then propose a solution. You have a set of entities which you can uniquely identify You care about the order (in the list) …
InformedA's user avatar
  • 3,021
0 votes

What is the best practice for reading a large number of custom settings from a text file?

I would suggest that you create a configuration class if you use java. Then you can use JAXB to annotate and serialize this class. …
InformedA's user avatar
  • 3,021
0 votes

What is the best way to work with large databases in Java depending on context?

I would do as much in java as possible because of the plethora of ways in which you can log, debug when somethings go wrong. …
InformedA's user avatar
  • 3,021
0 votes

How to simulate inner join on very large files in java (without running out of memory)

Why would you want to use "File Cache"? Caching is supposed to be used when you have some layer with faster accessing ability to reduce time on the slower layers. So if you read files through networ …
InformedA's user avatar
  • 3,021
8 votes
2 answers
7k views

Understanding JAVA generic keyword 'super'

Recently some people said that I was wrong when I explained why one cannot insert a Number object into a list declared as List<? super RationalNumber>. (This assumes that RationalNumber is a subclass …
InformedA's user avatar
  • 3,021
4 votes
2 answers
3k views

Do wildcards in Java generics restrict or increase flexibility?

The question is very simple: Do wilcards in Java generics increase flexibility? My understand is "No". Wildcards in Java generics (wilcards) actually decrease flexibility. … Is it therefore true that wildcards in Java actually decrease flexibility? If not, how is my reasoning flawed? …
InformedA's user avatar
  • 3,021
2 votes

Regex to String generation

I would like to propose this answer just in case it can help you some how. In case there are some details or some small errors, please leave comment. I will try to correct. First look at the minimum …
InformedA's user avatar
  • 3,021
0 votes

Is there a more intelligent way to do this besides a long chain of if statements or switch?

What I would do is this: Group the commands you have into groups. (you have at least 20 right now) At first level, categorize by group, so you have user name related command, song commands, count co …
InformedA's user avatar
  • 3,021
0 votes

calculate complexity of LinkedHashSet

For hashing operations like the contains() you have above, the worst case complexity is big O of n. This happens when there are n instances with the same hash value and the hashing implementation is c …
InformedA's user avatar
  • 3,021
1 vote

In Java, what are some good ways to separate APIs from implementation of entire projects?

From what I understand people often use the factory pattern for this. They put the API interfaces into separate module (say a jar file), and then when the clients want to use the API and has access t …
InformedA's user avatar
  • 3,021

15 30 50 per page