1.装箱 基本类型直接赋值一个引用类型 Integer I = 10; 拆箱 int i = I; 实际为 Integer I = Integer.valueOf(10); int i = I.intValue(); 2.枚举(enum) 简单情况下,与其他语言的enum相似 enum Light ...
分类:
编程语言 时间:
2020-07-19 23:33:12
阅读次数:
65
比较的接口Comparable,提供了一个比较的方法,所有实现该接口的类,都动态的实现了该比较方法。实际上Java中除了比较一个接口外,还提供了一个接口,该接口也是具有比较的功能,但该接口注重的却是比较容器,然后对其排序,这就是Comparator Map<String,Integer> map = ...
分类:
编程语言 时间:
2020-07-19 23:29:54
阅读次数:
69
851. 喧闹和富有 描述: 思路:深度优先(带记忆)。 这个题有点秒。。 853. 车队 描述: 思路: 我们首先对这些车辆按照它们的起始位置降序排序,并且用 (target - position) / speed 计算出每辆车在不受其余车的影响时,行驶到终点需要的时间。对于相邻的两辆车 S 和 ...
分类:
其他好文 时间:
2020-07-19 23:17:22
阅读次数:
92
class Solution { public List<Integer> getRow(int rowIndex) { Integer[] res = new Integer[rowIndex+1]; Arrays.fill(res,1); for(int i = 1; i <= rowIndex ...
分类:
编程语言 时间:
2020-07-19 17:46:05
阅读次数:
79
String转换为int String 字符串转整型 int 有以下两种方式: Integer.parseInt(str) Integer.valueOf(str).intValue() 注意:Integer 是一个类,是 int 基本数据类型的封装类。后续会讲到。 例如下面代码所示: public ...
分类:
编程语言 时间:
2020-07-19 16:11:11
阅读次数:
63
split() 方法用于把一个字符串分割成字符串数组。 reverse() 方法用于颠倒数组中元素的顺序。 join() 方法用于把数组中的所有元素放入一个字符串。 ...
分类:
其他好文 时间:
2020-07-19 00:41:27
阅读次数:
110
学习内容:包装类 1.Integer型包装类 代码实现: public class Integer包装类 { public static void main(String[] args) { // TODO 自动生成的方法存根Integer a1=new Integer(15);//创建方法一Int ...
分类:
编程语言 时间:
2020-07-18 22:44:51
阅读次数:
81
Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English. Input Specificat ...
分类:
其他好文 时间:
2020-07-18 21:49:07
阅读次数:
59
1.使用wait()/notifyAll实现生产者和消费者 1 /** 2 * 锁对象类 3 * 协作类 4 */ 5 public class MyQueue { 6 private Queue<Integer> queue; 7 private int limit; 8 9 public MyQ ...
分类:
编程语言 时间:
2020-07-18 15:30:39
阅读次数:
71
1、准备数据 1) 创建索引 2) 创建mapping JSON数据如下 { "properties": { "id": { "type": "long" }, "age": { "type": "integer" }, "username": { "type": "keyword" }, "nic ...
分类:
其他好文 时间:
2020-07-18 15:24:23
阅读次数:
90