YamlReader yamlReader = null;
try (InputStream resourceAsStream = DrugDealerValidator.class.getResourceAsStream("connection.yaml");
Reader reader = new InputStreamReader(resourceAsStream);
YamlReader yamlReader = new YamlReader(reader)) {
// работаем с yamlReader
}catch (IOException e) {
e.printStackTrace();
}
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.*;
String json = "[[{o:'-12188866'},{o:'-175'}],[{g:78554274,t:30718264}]]";
Type listType = new TypeToken<List<List<Map<String, String>>>>(){}.getType();
Gson gson = new GsonBuilder().create();
List<List<Map<String, String>>> list = gson.fromJson(json, listType);
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Function;
public final Map<Integer, List<String>> map = new ConcurrentHashMap<>();
public final Function<Integer, List<String>> mapFun = i -> new CopyOnWriteArrayList<>();
map.computeIfAbsent(1, mapFun).add("a");
map.computeIfAbsent(1, mapFun).add("b");
map.computeIfAbsent(1, mapFun).add("c");
String readFromFile(String fileName){
...
return result;
}
package ua.evhen.aspectj.demo.domain;
public class BankAccount {
private String pan;
private String panSate;
private String exDate;
private String panName;
private long clientId;
// getters and setter
}
package ua.evhen.aspectj.demo.aspect;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
@Aspect
public class BankAccountAspect {
@Before("execution(void ua.evhen.aspectj.demo.domain.*.set*(..)) && args(val)")
public void setMethod(Object val, JoinPoint jp) {
System.out.printf("%s := '%s'%n ", jp.getSignature().toShortString(), val);
}
}
public static void main(String args[]) {
Integer x = new Integer(5);
System.out.println(x);
x = change(x);
System.out.println(x);
}
public static void change(Integer x) {
x ++;
return x;
}
public enum A {
AAA {
public void i() {
System.out.println("Hi AAA");
}
},
BBB {
public void j() {
System.out.println("Hi BBB");
}
},
CCC;
public static void main(String[] args) {
System.out.println(A.AAA.getClass().getName());
System.out.println(A.BBB.getClass().getName());
System.out.println(A.CCC.getClass().getName());
}
}
static final class A
extends com.home.A {
A(String string2, int n2) {
super(string, n, null);
}
public void i() {
System.out.println("Hi AAA");
}
}