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
import { Component, Injectable, Directive, TemplateRef } from '@angular/core'; | |
import { NgbModal, NgbModalRef, NgbModalOptions } from '@ng-bootstrap/ng-bootstrap'; | |
/** | |
* Options passed when opening a confirmation modal | |
*/ | |
interface ConfirmOptions { | |
/** | |
* The title of the confirmation modal | |
*/ |
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 final class Rectangle { | |
private final int width; | |
private final int height; | |
public Rectangle(int width, int height) { | |
this.width = width; | |
this.height = height; | |
} | |
public int area() { |
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(); |
NewerOlder