String str;
while((str = reader.readLine()) != null){
str += str;
}
String resultStr;
String line;
while((line = reader.readLine()) != null){
resultStr += line;
}
String resultStr = String.join("\n", Files.readAllLines(file.toPath()));
spring:
jpa:
database: POSTGRESQL
show-sql: true
hibernate:
ddl-auto: create-drop
datasource:
platform: postgres
url: jdbc:postgresql://localhost:5432/mydb
username: foo
password: bar
driverClassName: org.postgresql.Driver
BufferedReader br = new BufferedReader(new FileReader("matrix.txt"));
List<String> lines = new ArrayList<>();
while (br.ready()) {
lines.add(br.readLine());
}
int matrixWidth = lines.get(0).split(" ").length;
int matrixHeight = lines.size();
Double[][] matrix = new Double[matrixHeight][matrixWidth];
for (int i = 0; i < matrixHeight; i++) {
for (int j = 0; j < matrixWidth; j++) {
String[] line = lines.get(i).split(" ");
matrix[i][j] = Double.parseDouble(line[j]);
}
}
for (int i = 0; i < matrixHeight; i++) {
System.out.println(Arrays.toString(matrix[i]));
}
String str1 = new String("java");
String str2 = new String("java");
System.out.println(str1 == str2);
System.out.println(str1.equals(str2));
List<String> listA = new ArrayList<String>(){{
add("A");
add("B");
add("C");
add("B");
add("A");
}};
List<String> listB = new ArrayList<String>(){{
add("A");
add("B");
}};
listA.removeIf(s -> {
if (listB.contains(s)) {
listB.remove(s);
return true;
}
return false;
});
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import static org.mockito.Mockito.*;
@Configuration
public class MockConfiguration {
@Primary
@Bean
public ActivitiGetTimerValueDelegateService activitiGetTimerValueDelegateService() {
ActivitiGetTimerValueDelegateService service = mock(ActivitiGetTimerValueDelegateService.class);
when(service.getTimerValue(any(), any(), any())).thenReturn(42);
return service;
}
}