This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import jakarta.servlet.Filter; | |
import jakarta.servlet.FilterChain; | |
import jakarta.servlet.ServletException; | |
import jakarta.servlet.ServletRequest; | |
import jakarta.servlet.ServletResponse; | |
import jakarta.servlet.annotation.WebFilter; | |
import jakarta.servlet.http.HttpServletRequest; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Don't do | |
return next(req).pipe( | |
catchError(error => { | |
const status = error.status; | |
if (status === HttpStatusCode.BadRequest) { | |
// ... | |
} else { | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Pojo parseJson(String json) { | |
// parse | |
return pojo; | |
// don't catch the exception. If there is an exception, there is a bug, so you shouldn't catch it and ignore it | |
// that will only cause a cryptic NullPointerException later. | |
} | |
public Mono<Pojo> query(long id) { | |
Integer value = idMapper.getValue(id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.stream.Collectors; | |
public class Benchmark { | |
public static void main(String[] args) { | |
System.out.println(Arrays.asList(1, 2, 3, 4, 5) | |
.stream() | |
.filter(i -> i > 10) | |
.map(i -> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.nio.charset.Charset; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
import java.util.Collections; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
public class MyCustomObject{ | |
private String appName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.demo; | |
public class Employee { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.foo; | |
import java.io.IOException; | |
import java.io.Serializable; | |
import java.util.List; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
public class QnA implements Serializable { | |
private long idQnA; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.Collections; | |
import java.util.HashSet; | |
import java.util.Set; | |
public class InterfaceTest { | |
interface TestInterface { | |
default Set<String> getRequiredStrings() { | |
return Collections.emptySet(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ComponentFixture, TestBed } from '@angular/core/testing'; | |
import { Component, Input, OnInit } from '@angular/core'; | |
@Component({ | |
selector: 'foo', | |
template: 'hello {{ nameCopy }}' | |
}) | |
class FooComponent implements OnInit { | |
@Input() name: string; | |
nameCopy: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class Course(val id: Long, val students: MutableSet<Student> = mutableSetOf()) | |
data class Student(val id: Long, val courses: MutableSet<Course> = mutableSetOf()) | |
fun main() { | |
val english = Course(1L) | |
val john = Student(1L) | |
english.students.add(john) | |
john.courses.add(english) | |
println(john) // StackOverflowError |
NewerOlder