TODO:
JPARepository<Model, PrimaryKeyType> with custom functions@NotBlank: Checks that the annotated character sequence is not null and the trimmed length is greater than 0.@NotNull: Checks that the annotated value is not null, however it can be empty.@NotEmpty: Checks whether the annotated element is not null nor empty.lombok annotation @Getter and @Setter to be able to (de-)serialize correctly.@Service annotation makes this a Bean whose lifecycle is managed by SpringJpaRepository<JobApplication, Long>
synchronized (this) { ... }
synchronized
Semaphore usage via new Semaphore(int capacity)
public class MyRunner implements Runnable {
@Override
public void run() {
// Actual task execution
}
}
ExecutorService executor = Executors.newFixedThreadPool(5);
Runnable worker = new MyRunner();
executor.execute(worker);
executor.shutdown();
while (!executor.isTerminated()) {
// wait...
}StringdoubleintfloatList<Integer> l = new LinkedList<>();
l.add(1) O(1)l.remove(int index) O(1)Stack<Integer> s = new Stack<>();
s.push(1)s.pop()s.peek()PriorityQueue<Integer> q = new PriorityQueue<>();
q.offer(1);q.peek();q.poll();Map<Integer, Integer> m = new HashMap<>();
m.size()m.get(int key)m.put(int k, int v)int[] x = new int[5];
Deque<Integer> d = new LinkedList<>();
d.addFirst(1)d.getFirst()d.addLast(1)d.getLast()Atomic types leverage CPU instructions to do “compare and swap” operations efficiently without using synchronized which would add a lot of overhead.
Available types are
AtomicIntegerAtomicBoolean