Skip to content

Tag: java

What’s the advantage of load() vs get() in Hibernate?

Can anyone tell me what’s the advantage of load() vs get() in Hibernate? Answer Whats the advantage of load() vs get() in Hibernate? load() get() Only use load() method if you are sure that the object exists. If you are not sure that the object exist, then use one of get() methods. load() method will th…

Limit Decimal Places in Android EditText

I’m trying to write an app that helps you manage your finances. I’m using an EditText Field where the user can specify an amount of money. I set the inputType to numberDecimal which works fine, except that this allows people to enter numbers such as 123.122 which is not perfect for money. Is there…

What is the simplest way to draw in Java?

What is the simplest way to draw in Java? This doesn’t work and I have no idea how to get anything to appear. Answer Easiest way: You simply need to extend JPanel and override the paintComponent method of the panel. I’d like to reiterate that you should not be overriding the paint method. Here is …

Intersection and union of ArrayLists in Java

Are there any methods to do so? I was looking but couldn’t find any. Another question: I need these methods so I can filter files. Some are AND filters and some are OR filters (like in set theory), so I need to filter according to all files and the unite/intersects ArrayLists that holds those files. Sho…