摘要: 1 生成二维数组 private void fillRandom(long seed) { final Random random = new Random(seed); IntStream.range(0, size) .forEach(row -> IntStream.range(0, size 阅读全文
posted @ 2020-11-19 17:19 longlong6296 阅读(149) 评论(0) 推荐(0)
摘要: 1 输出棋盘的方法: static void drawBoard(char[][] board) { char letters = 'A'; int digits = 1; for (int i = 0; i <= 10; i++) { for (int j = 0; j <= 10; j++) { 阅读全文
posted @ 2020-11-11 17:00 longlong6296 阅读(165) 评论(0) 推荐(0)
摘要: 注意在循环中在try语句中使用nextInt()方法至少两次以上时,如果在第一次nextInt() catch exception 并重新执行循环,那么接下来的nextInt()执行的是之前输入行未读取晚剩下的部分, 有可能进入循环。解决方法是 先全部读取成,然后再判断. private void 阅读全文
posted @ 2020-11-05 12:29 longlong6296 阅读(98) 评论(0) 推荐(0)
摘要: Sometimes after mapping and filtering a stream, you need to use it more than one time. For example, find the maximum and count all the elements of a r 阅读全文
posted @ 2020-09-30 08:34 longlong6296 阅读(63) 评论(0) 推荐(0)
摘要: Implement a method for finding min and max elements of a stream in accordance with a given comparator. The found elements pass to minMaxConsumer in th 阅读全文
posted @ 2020-09-29 09:16 longlong6296 阅读(111) 评论(0) 推荐(0)
摘要: Given a class named Range. It represents a range from A (inclusive) to B (exclusive). The class implements the interface Iterable, therefore, an insta 阅读全文
posted @ 2020-09-28 14:39 longlong6296 阅读(98) 评论(0) 推荐(0)
摘要: You're dealing with a string consisting of brackets. Write a program to examine whether the pairs of "{", "}", "(", ")", "[", "]" are correct or balan 阅读全文
posted @ 2020-09-28 12:24 longlong6296 阅读(137) 评论(0) 推荐(0)
摘要: Some info: HTML is a markup language, that is based on tags. There are many types of tags, for example, html, div, h1, h2. Each type of tag has start 阅读全文
posted @ 2020-09-28 11:08 longlong6296 阅读(217) 评论(0) 推荐(0)
摘要: Write a program simulating a stack that can effectively return the current max element. Your program should read a sequence of commands of different t 阅读全文
posted @ 2020-09-28 08:50 longlong6296 阅读(154) 评论(0) 推荐(0)
摘要: The simplest spell checker is the one based on a list of known words. Every word in the text is being searched for in this list and, if such word was 阅读全文
posted @ 2020-09-27 19:33 longlong6296 阅读(107) 评论(0) 推荐(0)