PCSalt
YouTube GitHub

# java

4 posts

Rearrange positive and negative numbers in an array — Java

Partition an array so all negative numbers appear on the left and positive numbers on the right, in-place with only one extra variable.

Convert JSON to comma-separated key=value pairs — Java

Recursively flatten a nested JSON object into a compact comma-separated key=value string in Java.

== vs equals() in Java — What's the difference?

Understanding the difference between the == operator and equals() method in Java, and why using the wrong one leads to subtle bugs.

String Concatenation in Java — concat() vs + vs StringBuilder

Understanding the real differences between concat(), the + operator, and StringBuilder in Java — what actually matters and what doesn't.