Tags » Java 2

Concurrent Unit Tests

In general, my heart sinks when I think I may have to write some unit tests for threaded code. This can be fiendishly difficult, and the secret with it is not to test things too absolutely, as timings and orders of events can be impossible to predict. 491 more words

Java 8, lambda, functional interfaces, method reference, constructor reference

package e;

import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;

@SuppressWarnings("unused")
public class FunctionalInterfaces {

    public interface Callback {
        void doSth();
    }

    public static class Person {
        private String name;
        private int age;
        public Person() {
        }
        public Person(String name, int age) {
            this.age = age;
            this.name = name;
        }
        public String getName() {
            return name;
        }
        public int getAge() {
            return age;
        }
        public void setName(String name) {
            this.name = name;
        }
        public void setAge(int age) {
            this.age = age;
        }
    }
    
    static class PersonComparer {
        public int compareByAge(Person p1, Person p2) {
            int age1 = p1.getAge();
            int age2 = p2.getAge();
            return age1 == age2 ? 557 more words
Java

Signalling between threads in Java

Various releases of Java have introduced more sophisticated concurrency patterns to Java. You don’t need to build your own thread pooling techniques, or queues between threads. 636 more words

Mount Bromo: It’s stunning but…

Mount Bromo is one of the most stunning sights of Indonesia – and even of all of Southeast Asia – so, obviously, also one of the most visited attractions. 1,482 more words

#Asia

Java Thread Questions

Java Thread tutorial from Javarevisited Blog

  1. Why wait and notify method must be called in synchronized context? (see here)
  2. How Synchronization works in Java?
  3. 97 more words
Java

Java interview questions for senior java developer

  • 20 String Coding Questions for Programmers ( read here)
  • 15 Data Structure and Algorithm questions for Software developers (see here)
  • 10 Interview Questions Every Developer Should Know (
  • 100 more words
Java