Skip to content

Instantly share code, notes, and snippets.

donchan922 donchan922

Block or report user

Report or block donchan922

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View env.txt
- mybatis-spring-boot-starter: 2.0.1
- mybatis: 3.5.1
View DemoApplication.java
@Transactional(readOnly = true)
@Override
public void run(String... args) throws IOException {
try (Cursor<City> cities = cityMapper.findAll()) {
for (City city : cities) {
System.out.println(city.toString());
}
}
}
View DemoApplication.java
@SpringBootApplication
public class DemoApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
private final CityMapper cityMapper;
public DemoApplication(CityMapper cityMapper) {
View DemoApplication.java
StringBuilder stringBuilder = new StringBuilder();
String[] names = {"Alice", "Bob", "Carol"};
String prefix = "";
for (String name : names) {
stringBuilder.append(prefix);
prefix = ",";
stringBuilder.append(name);
}
View DemoApplication.java
StringBuilder stringBuilder = new StringBuilder();
String[] names = {"Alice", "Bob", "Carol"};
for (String name : names) {
stringBuilder.append(name);
stringBuilder.append(",");
}
// Alice,Bob,Carol, <- 末尾の,が邪魔
System.out.println(stringBuilder.toString());
View DemoApplication.java
String[] array = {"Alice", "Bob", "Carol"};
System.out.println(String.join("\t", array)); // Alice Bob Carol
View DemoApplication.java
List<String> list = new ArrayList<>();
list.add("Alice");
list.add("Bob");
list.add("Carol");
System.out.println(String.join(",", list)); // Alice,Bob,Carol
View DemoApplication.java
String[] array = {"Alice", "Bob", "Carol"};
System.out.println(String.join(",", array)); // Alice,Bob,Carol
View with_header_tsv
id name age
001 Alice 18
002 Bob 25
003 Carol 23
View with_header_tsv
id name age
001 Alice 18
002 Bob 25
003 Carol 23
You can’t perform that action at this time.