资讯专栏INFORMATION COLUMN

Java - Basics

songze / 2020人阅读

Explanation of Terms

In-Place Algorithm(原地算法): an in-place algorithm is an algorithm which transforms input using no auxiliary data structure. However a small amount of extra storage space is allowed for auxiliary variables. The input is usually overwritten by the output as the algorithm executes. In-place algorithm updates input sequence only through replacement or swapping of elements. (Wikipedia)

Basic Knowledge Character Class

https://www.tutorialspoint.co...

https://docs.oracle.com/javas...

Integer to String

Convert using Integer.toString(int)

Convert using String.valueOf(int)

To Declare an ArrayList with Values

For example

List temp = new ArrayList(Arrays.asList("1", "12"));
Iterate through a HashMap

https://stackoverflow.com/que...

If you"re only interested in the keys, you can iterate through the keySet() of the map:

Map map = ...;

for (Object key : map.keySet()) {
    // ...
}

If you only need the values, use values():

for (Object value : map.values()) {
    // ...
}

Finally, if you want both the key and value, use entrySet():

for (Map.Entry entry : map.entrySet()) {
    Object key = entry.getKey();
    Object value = entry.getValue();
    // ...
}
Coding Test i++ & ++i 赋值
public class test {

    public static void main(String[] args) {    
        
        int i1=0, i2=0, i3=0, i4=0, index1=0, index2=0, index3=0, index4=0;
        int[] num1 = new int[10];
        int[] num2 = new int[10];
        int[] num3 = new int[10];
        int[] num4 = new int[10];
        while (index1 < 5 && index2 < 5 && index3 < 5 && index4 < 5) {
            num1[index1++] = i1++;       //01234  
            num2[++index2] = i2++;       //001234  
            num3[index3++] = ++i3;       //12345
            num4[++index4] = ++i4;       //012345
        }
        for (int n : num1) {
            System.out.print(n);
        }
        System.out.println();
        for (int n : num2) {
            System.out.print(n);
        }
        System.out.println();
        for (int n : num3) {
            System.out.print(n);
        }
        System.out.println();
        for (int n : num4) {
            System.out.print(n);
        }
    }
}

/* Output
 * 0123400000
 * 0012340000
 * 1234500000
 * 0123450000
*/
要写的

StringBuilder & StringBuffer

Stack & Queue

Hash Table & HashMap & HashSet

Iterator

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/67189.html

相关文章

  • 猫头鹰的深夜翻译:使用SpringBoot和AspectJ实现AOP

    摘要:我们会写切面来拦截对这些业务类和类的调用。切面定义何时拦截一个方法以及做什么和在一起成为切面连接点当代码开始执行,并且切点的条件满足时,通知被调用。 前言 这篇文章会帮助你使用Spring Boot Starter AOP实现AOP。我们会使用AspectJ实现四个不同的通知(advice),并且新建一个自定义的注解来追踪方法的执行时间。 你将会了解 什么是交叉分割关注点(cross...

    meislzhua 评论0 收藏0
  • 词法 - Javascript核心 - Javascript语法基础

    摘要:原文源码的词法结构字符集程序是用字符集。支持地球上几乎所有在用的语言。是区分大小写的语言的。与在是不同的,在是相同的。会忽略程序中标识之前的空格。多数情况下也会忽略换行符。 原文: http://pij.robinqu.me/JavaScript_Core/JavaScript_Basics/Lexical.html 源码: https://github.com/Rob...

    lakeside 评论0 收藏0

发表评论

0条评论

songze

|高级讲师

TA的文章

阅读更多
最新活动
阅读需要支付1元查看
<