Ayush
Ayush @viperdizzert ·
Stop writing loops for every collection. Use Java Streams. 🧵 ​Your future self (and your code reviewers) will thank you. ​#JavaTips #javaA
60
Kolusu Trinadh Kumar
Kolusu Trinadh Kumar @KolusuTrinadh ·
From Java 11 , Arrays.sort() uses TimSort internally. You don't need to write the TimSort algorithm yourself. This is a significant convenience. #JavaTips
1
20
Akshay M
Akshay M @akshayxml ·
Java's `Integer` cache: Between -128 and 127, Java caches Integer objects to improve performance. This means if you use a value within this range, it will return the same object instance each time. #JavaTips #PerformanceOptimization
23
codeBuilder
codeBuilder @nishek_sharma ·
Just realized you can do this in Java: Map<String, List<String>> map = new HashMap<>(); map.put("fruits", new ArrayList<>()); map.get("fruits").add("apple"); map.get("fruits").add("banana"); map.values() = all your lists in one go 🥳 Mind blown �� #JavaTips #CodingLife #DevHack
10
Crack Ease
Crack Ease @CrackEase1519 ·
Sharp • Dev-centric • Scroll-stopping Java lets you create your own errors — not just handle them. 🌋 Custom Exceptions help you define, throw, and control errors your way. Clean code. Clear logic. Better debugging. �crackease.com5E #Java #CustomExceptions #JavaTipZa
1
Akshay M
Akshay M @akshayxml ·
"Java's default string concatenation using + operator creates a new object each time, whereas using StringBuilder/StringBuffer can reduce memory allocation & improve performance." #JavaTips #PerformanceOptimization
5
Programando en Java
Programando en Java @ProgEnJava ·
📦 Una clase, UNA sola razón para cambiar. ¿Difícil? Sí. ¿Necesario? También. El principio de responsabilidad única no es opcional, es supervivencia en Java. 🔥 Menos es más. #CleanCode #JavaTips #SRP 👉 ¿Tu código lo respeta?
1
415
Automation
Automation @automation25 ·
Use try-with-resources for automatic resource management, ensuring all opened resources are closed efficiently and safely, even if exceptions occur. `try (FileInputStream fis = new FileInputStream("file.txt")) { /* ... */ }` #Java #JavaTips
9
Akshay M
Akshay M @akshayxml ·
In Java, when using `equals()` method on objects, it compares references by default. To compare object values, override `equals()` and implement `hashCode()` correctly to ensure correct behavior. #JavaTips #ObjectOrientedProgramming
5