java
482 tutorials tagged “java”.
- Anonymous Class vs LambdaAnonymous classes and lambdas can both implement an interface inline. Learn the differences in syntax, this, state, interfaces supported and performance.
- Difference Between Array and ArrayListArray vs ArrayList in Java: fixed vs dynamic size, primitives vs objects, length vs size(), performance, and when to use each, with examples.
- ArrayList Internal WorkingHow ArrayList works inside: the internal array, default capacity of 10, growth by 1.5 times, copying on resize, and the cost of add, get and remove.
- Difference Between ArrayList and LinkedListArrayList vs LinkedList in Java: internal structure, speed of get, add and remove, memory use, and how to choose, with a timing example.
- Difference Between ArrayList and VectorArrayList vs Vector in Java: synchronization, performance, growth rate, legacy methods and iteration. Learn the differences and which one to use.
- Arrays.asList vs List.ofArrays.asList and List.of both create lists quickly, but differ in mutability, null support and their link to the array. Learn every difference with examples.
- Atomic Variables in JavaAtomic classes such as AtomicInteger, AtomicReference and LongAdder update values safely without locks. Learn their methods and when LongAdder wins.
- Base64 Encoding and Decoding in JavaEncode and decode data as Base64 text with java.util.Base64: basic, URL-safe and MIME encoders, padding, and why Base64 is not encryption.
- Buffered Streams in JavaBuffered streams cut disk access by reading and writing in large blocks. Learn BufferedReader, BufferedWriter and friends, and measure the speed-up.
- Creating a Javap ToolBuild your own small javap: read the class file header by hand, then use the Class-File API to list fields, methods and bytecode instructions.