Sobes.tech

What pattern is implemented in the chain FileInputStream → BufferedInputStream → InputStreamReader → BufferedReader?

176

How to write a unit test for a method that calls an external system so that no real call occurs?

169

How do you fetch specific commits from another branch in Git?

162

Returns a list of book tags for authors specified by a list of identifiers.

160

What other second solution can be proposed for comparing two Person objects?

159

What needs to be done to make the Person class immutable?

156

What is the contract between equals() and hashCode()?

150

What are the main interfaces in the Java Collection API?

150

public class RefEx { public interface DocumentProcessor { void process(Document document); } public static class PdfProcessor implements DocumentProcessor { @Override public void process(Document document) { // Specific logic for processing PDF } } public static class DocxProcessor implements DocumentProcessor { @Override public void process(Document document) { // Specific logic for processing Word } } public static class XmlProcessor implements DocumentProcessor { @Override public void process(Document document) { // Specific logic for processing XML } } public static class DocumentService { private final Map<DocumentType, DocumentProcessor> processors = Map.of( DocumentType.PDF, new PdfProcessor(), DocumentType.DOCX, new DocxProcessor(), DocumentType.XML, new XmlProcessor() ); public void process(Document[] documents) { for (Document doc : documents) { // General document processing logic processors.get(doc.type).process(doc); } } } }

149

What is the Comparable interface and how is it used?

144

public static void filterTripleA(Collection<String> strings) { strings.removeIf(s -> s.startsWith("aaa")); }

142

public class RefEx { public static class PdfProcessor implements DocumentProcessor { } public static class DocxProcessor implements DocumentProcessor { @Override public void process(Document document) { // Specific logic for processing Word } } public static class XmlProcessor implements DocumentProcessor { @Override public void process(Document document) { // Specific logic for processing XML } } public static class DocumentService { private final Map<DocumentType, DocumentProcessor> processors = Map.of( DocumentType.PDF, new PdfProcessor(), DocumentType.DOCX, new DocxProcessor(), DocumentType.XML, new XmlProcessor() ); public void process(Document[] documents) { for (Document doc : documents) { DocumentProcessor processor = processors.get(doc.type); if (processor == null) { break; } // General document processing logic processor.process(doc); } } } }

140

Where can a NullPointerException occur in the getTagsOfAuthorsBooks method?

140

What is an annotation in Java?

133

Given the following Java class class Person { String firstName; String lastName; Integer age; } Implement a standard method that compares two Person objects.

121

Tell us about yourself and your work experience (not repeating your resume): interesting tasks, business context, what you did personally.

113

What protocols, frameworks, and libraries exist in Java for working with DBMS?

110

What is GOF (Gang of Four) and which patterns from this book are implemented in the standard JDK?

109