Tagged articles
4 articles
Page 1 of 1
Java Tech Enthusiast
Java Tech Enthusiast
May 1, 2024 · Fundamentals

Pitfalls of Arrays.asList in Java

Java's Arrays.asList method has three major pitfalls: it cannot directly convert primitive arrays like int[] because of autoboxing limits, it returns a fixed-size list that throws UnsupportedOperationException on modification, and the list shares its backing array so changes to the original array are reflected in the list; using Arrays.stream for boxing or wrapping the result in a new ArrayList avoids these issues.

Arrays.asListCode ExamplesCollections
0 likes · 4 min read
Pitfalls of Arrays.asList in Java
Java Architect Essentials
Java Architect Essentials
Nov 5, 2023 · Fundamentals

19 Real‑World Bad Code Snippets Every Developer Should Avoid

This article curates 19 genuinely terrible code fragments collected from various developers, illustrating common pitfalls such as magic numbers, poorly named variables, misuse of booleans, and overly complex switch statements, and encourages readers to reflect on and learn from these mistakes.

JavaSoftware Engineeringbad code
0 likes · 8 min read
19 Real‑World Bad Code Snippets Every Developer Should Avoid
Alibaba Cloud Developer
Alibaba Cloud Developer
Apr 13, 2020 · Backend Development

Avoid Common Java Pitfalls: Object Comparison, Ternary Unboxing, Generics & More

This article examines frequent Java development traps—including object comparison quirks, ternary‑operator unboxing, generic type mismatches, property‑copy issues, Set deduplication, and Spring CGLIB proxy pitfalls—provides bytecode‑level analysis, and offers practical coding guidelines and best‑practice solutions to prevent them.

Javaprogramming pitfalls
0 likes · 24 min read
Avoid Common Java Pitfalls: Object Comparison, Ternary Unboxing, Generics & More