Here are questions 31-60, covering the rest of your syllabus. Garbage Collection doesn't get its own block since Q24 already covers it. One file per question again, with a main method unless stated.

Lambda Expressions & Functional Interfaces

  1. Write a generic Pipeline<T> that chains Function<T,T> stages built from lambdas and method references. Support addStage, execute, and a Predicate<T> guard that skips a stage when it fails. Demonstrate Supplier, Consumer, UnaryOperator and BiFunction with one realistic use each.
  2. Implement your own memoize(Function<K,V>) that wraps any function with a HashMap cache and returns a new function. Use it to speed up a recursive Fibonacci, and print the call counts with and without memoization. Add a curried Function<Integer, Function<Integer,Integer>> adder.

Wrapper Classes & Strings

  1. Write a method that checks whether two strings are anagrams, ignoring case and spaces. Then write one that finds the first non-repeating character, and one that compresses aaabbc into a3b2c1, all without using collections for the first and third.
  2. Implement a palindrome toolkit: check a plain string, check ignoring punctuation and case, find the longest palindromic substring using expand-around-center, and count all palindromic substrings.
  3. Compare String, StringBuilder and StringBuffer: concatenate 100,000 times with each, time them with System.nanoTime, and print the results. Demonstrate reverse, insert, deleteCharAt and setLength, and show the string pool with new String("a") versus a literal versus intern().
  4. Parse a CSV line that may contain quoted fields with commas (John,"Doe, Jr.",25) into a String[] without using split or any library. Add a method that converts each field to Integer or Double when possible using parseInt/valueOf, handling NumberFormatException.

Exception Handling

  1. Create a custom checked InsufficientFundsException and an unchecked InvalidAccountException. Write an ATM simulation where a method declares one and throws the other. Demonstrate multi-catch, finally ordering, and a case where finally overrides a return.
  2. Implement a resource class that implements AutoCloseable, and use it in try-with-resources with two resources. Make both close() methods throw, and print the primary and suppressed exceptions. Show the closing order.
  3. Write a retry utility retry(int attempts, Callable<T> task) that retries on a specified exception type, rethrows a wrapped custom exception with the original as cause after the last failure, and prints the full cause chain and a stack trace excerpt.

File I/O

  1. Write a word-frequency program: read a text file with BufferedReader and print the top 10 words with counts. Create the input file from code if it is missing. Compare it with a Files.lines version.
  2. Build a mini file manager: using java.nio.file, recursively walk a directory with Files.walkFileTree, print an indented tree with file sizes, find the 5 largest files, then copy one file and delete the copy. Handle IOException properly.

Serialization & De-serialization

  1. Serialize a Student object graph (with a nested Address and a list of Course objects) to a file and read it back. Mark one field transient (a password), show that it comes back null, and explain serialVersionUID by changing the class and showing the InvalidClassException.
  2. Write a class with custom writeObject/readObject that encrypts the password with a simple Caesar shift during serialization. Then implement a Singleton that stays a singleton after deserialization using readResolve, and prove it with ==.

Date & Time API