« first day (1497 days earlier)      last day (3450 days later) » 

7:00 PM
Does anyone know why a lot of people style Java as "JAVA"? Is there some or other silly book that promotes that asinine usage?
 
It's two minutes to three AM, sleep is overdue
JAVA the meme or the usage? @Boann
 
@Unihedron I mean I see it in questions on SO, in the title usually.
 
@Unihedron this is nuts! BigSh*ts are cranking me up like WTF
 
Oh, it's just a misuse. In Java text books, the cover usually has 'java' in caps, leaving the rest with proper capitalization.
There is no promotion of using JAVA otherwise.
But there are indeed false signals from books. It doesn't happen to python, BTW.
 
@uni go to sleep
 
7:05 PM
Night!
 
Quadtree is interesting, but i guess a binary tree can also work @kiheru
@Unihedron night
 
Same family of data structures. Octree would be the next... I don't know if anyone has made up names for higher dimensions (or had use for them even)
 
7:23 PM
hey everyone... have you dealt with financial computations...
i have things that im dividing, and there are thing like 1/3 which has too long of remainders to show.. so you end up rounding up...
 
The only financial calculations I do are my own money
 
*sigh... this is hopeless
 
I'd think the needed rounding mode would be in the specifications
 
im so sleepy now..
yep.. i used rounding... but then ... its a long story. T.T
 
When working with economic calculations, rounding up is how you lose millions >_>
 
7:34 PM
because of it, i cant compare them to zero absolutely... there has to be a precision too that would pass as within accepted as zero
 
Unless your code is supposed to do fractions, rounding can't be avoided. You just need to use the correct mode
 
@Gemtastic absolutely.. ahaha
@kiheru thanks! :D but then... i dont know how to explain myself this late
i ahave to sleep now.. thanks guys! :D
 
yw. good night!
 
:)
 
(I don't think rational numbers come in the standard library. This is java, not scheme)
 
7:37 PM
Night night
 
8:00 PM
Night
 
fge
8:26 PM
Huh, IDEA 14 has "funny" annotations sometimes
@Contract(pure = true) -- go figure... No idea how inspections make use of that
 
I have for a long time wanted to have a pure function qualifier (in several languages). Something that can't have any side effects. Call only other pure functions, and must not modify any outside variables.
Sounds like the guys at jetbrains thought the same
I'd like that at compiler level though. That would be really nice for some optimizations. GCC has the __attribute__((const)) for that purpose
 
@Contract(pure == true){
    wedding.run();
}
 
Fully pure functional languages seem more an excercise in mental masturbation, but I'd really like to mark the parts of the code that are pure functional.
As for the inspections, I don't know... a call to a pure method without assigning to a variable could be marked as dead code. For optimization multiple calls with same arguments would count for common subexpression elimination, and maybe some warnings can be made based on that
 
fge
9:03 PM
1
Q: Why no ConcurrentModificationException here

PeteyPabProConsider the following code snippet: List<String> list = new LinkedList<>(); list.add("Hello"); list.add("My"); list.add("Son"); for (String s: list){ if (s.equals("My")) list.remove(s); System.out.printf("s=%s, list=%s\n",s,list.toString()); } This results in output: s=Hello, list=[...

Interesting question
 
I have always read the Set is a collection that doesn't allow duplicate insertion, right?
But in my case today, it's inserting duplicate objects :( I don't know what's wrong with it
@fge any help?
 
fge
@Mr.777 the contract of Set doesn't lie, you must be doing something wrong; but no code, no help
 
I am creating a static Set of User
 
And then simply add it
 
9:10 PM
add it?
 
yes
 
fge
Well, show your User class then
And also, what implementation of Set are you using?
 
User class has a String name, String email and int imageId
HashSet
 
fge
Do you define both hashCode() and equals() in your User class?
 
no i don't define hashcode & equals
 
fge
9:11 PM
Well, there you are
 
yep, got it ;)
 
fge
Read the javadoc for Object carefully about those two methods
 
@fge Yes, I am doing that
 
I think I have seen a somewhat similar situation where someone managed to modify an ArrayList during iteration, in the same thread, and didn't get an exception. That was a clear corner case though
The docs are clear though. The exceptions can not be relied to be thrown
(TreeSet comes with yet another contract: compareTo() needs to be consistent with equals())
 
fge
@kiheru no, no need
TreeSet only relies on .compareTo()
No need for it to be consistent with .equals() (example: BigDecimal)
 
9:34 PM
@fge That's interesting. TreeSet docs state that "Note that the ordering maintained by a set (whether or not an explicit comparator is provided) must be consistent with equals if it is to correctly implement the Set interface.", but indeed, BigDecimal does not obey that contract. OTOH, looks like BigDecimal does not work with Treeset.
 
fge
Oh, actually that's my answer
 
rofl
BigDecimal documents the inconsistense correctly, at least. I did not know it having had no use for the class, but it's a good thing to remember
I have written a class or two that also have an ordering that's inconsistent with equals() (hopefully remembered to document them too). An undocumented inconsistence would be a nasty thing to debug.
 
10:33 PM
Awww there is night in the room.
 

« first day (1497 days earlier)      last day (3450 days later) »