202305-02 JVM 核心技术 —— 工具与 GC 策略 JVM 核心技术 —— 工具与 GC 策略 1 JDK 内置命令行工具 jps -l 查看所有 Java 进程的进程号 jps -mlv 加上mlv参数之后可以打印更详细的信息(JVM 启动参数) jinfo 进程号 打印 JVM 的配置信息 PS C:\Window.... Read More >
201907-13 LeetCode-1 Two Sum 解析 题目: 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。 你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。 示例: [go]给定 nums = [2, 7, 11, 15], target = 9 因为 nums[0] + nums[1] = 2 + 7 = 9 所以返回 [0, 1.... Read More >
201903-14 Go内建容器之映射(map) 映射是一种数据结构,用于存储一系列无序的键值对。 注: 1.map内部使用Hash表 2.除了slice,map,function的内建类型都可以作为map的key 3.struct类型不包含上述字段,也可作为key 创建和初始化 使用make声明map [go]m.... Read More >
201903-09 Go内建容器之切片(slice) 切片(slice)是一种数据结构,这种数据结构便于使用和管理数据集合。切片是围绕动态数组的概念构建的,可以按需自动增长和缩小。切片的动态增长是通过内置函数append来实现的,这个函数可以快速且高效地增长切片。还可以通过对切片的再次切片来缩小一个切片的大小。因为切片的底层内存也是在连续块中分配的,所.... Read More >
201903-09 Go内建容器之数组 数组的声明 [go]var arr1 [5]int arr2 := [3]int{1, 3, 5} arr3 := [...]int{2, 4, 6, 8, 10} var xy [3][4]bool //三行四列的二维数组[/go] 数组的遍历 [go]func trave.... Read More >
201902-24 Go语法之for循环 示例 计算从1加到100 [go]sum := 0 for i:=1;i<=100;i++ { sum += i } fmt.Println(sum)[/go] 注意:for的条件不用加括号 for的条件里不写分号,相当于其他语言的while 改写上例片段 .... Read More >
201902-23 Go语法之switch 第一种写法 ------ switch x 注意:switch会自动break,除非使用fallthrough [go]func branch(a, b int, op string) int { var result int switch op { cas.... Read More >
201902-23 Go语法之if条件语句 第一种写法 [go]contents, err := ioutil.ReadFile("filename.txt"); if err != nil { fmt.Println(err) } else { fmt.Printf("%s\n", .... Read More >
201902-02 Go语言变量声明 Go语言变量声明方法 1.通过关键字var [go]var one int //var 变量名 类型 var two int = 2 //为变量赋初值 var three = 3 //编译器能自动识别变量类型[/go] 2.通过:=简易声明 [go]one := 1 .... Read More >
201901-24 Go语言实现Hello world [go]package main import "fmt" func main() { fmt.Println("Hello,world!") }[/go] .... Read More >