THE THIRTEENTH DAY
2018-03-21 21:43
274 查看
今天星期三,参加培训的第十三天,像往常一样,早早起床,然后吃饭,两个包子,就在教室开始看书了,看的是String,StringBuilder,什么.toString,.length(),.concat(),.subring(),.indexOf,.toUpper,.toLowwer,等等,然后还看了File对象,isEmpty(), isdirtory(), .next(), .nextInt() , nextLine(),读的是分隔符开始到下一个分隔符,若为1Enter2,则读到的是1和空行。
然后上课,老师讲了一下昨天的东西,Arrays.sort(list4,String.CASE_INSENSITIVE_ORDER); 是按字母表排序, Arrays.sort(list5,Collections.reverseOrder()); 是降序排序,
Arrays.sort(list5, new Comparator<Integer>() { //自定义排序
@Override
public int compare(Integer o1, Integer o2) {
// TODO Auto-generated method stub
return (o2-o1);
}
});
还有选择文件:JFileChooser fileChooser = new JFileChooser();
if(fileChooser.showOpenDialog(null)==JFileChooser.APPROVE_OPTION) {
File file1 = fileChooser.getSelectedFile();
Scanner input = new Scanner(file1);
while(input.hasNext()) {
System.out.println(input.nextLine());
}
input.close();
} else {
System.out.println("No file selected");
}
然后还讲了集合,有八个好像。。:
public void arrayList() {
//添加有序,有索引 可重复
ArrayList<String> list = new ArrayList<>();
}
public void linkedList() {
LinkedList<String> list = new LinkedList<>();
}
public void vector() { //线程安全的,不能同时访问。
Vector<String> vt = new Vector<>();
}
public void hashSet() {
HashSet<String> s1 = new HashSet<>();//不能有重复数据。。。没有索引号,内容有序非添加顺序
Iterator<String> it = s1.iterator();
while(it.hasNext()) {
String str = it.next();
}
}
public void treeSet() {
TreeSet<String> t = new TreeSet<>();//用compareto来排序的,可以重写compareto方法
}
public static void hashMap() {
HashMap<String,String> m = new HashMap<>();//先键后值 code根据键来定
m.put("0", "00");
System.out.println(m.remove("0"));//key值不能重复
m.get("0");
for(Entry<String,String> a : m.entrySet()) {
}
for(String ss: m.keySet()) {
}
for(String ss:m.values()) {
}
}
public static void hashTable() {
Hashtable<String,String> m2 = new Hashtable<>();//线程安全
}
public static void treeMap() {
TreeMap<String,String> m3 = new TreeMap<>();//自定义排序
}
然后今天晚上看了一下继承和多态,通过父类实现动态绑定,用到instanceof,还看了字节转化为字符的方法,先解码在编码,
String str = "ddddssffae";
byte[] bytes;
try {
bytes = str.getBytes("utf-8");
System.out.println(Arrays.toString(bytes));
String str1 = new String(bytes,"utf-8");
System.out.println(str1);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
别的好像也没有什么了,那就结束吧,但是又想起了什么,myeclipse的插件问题,在help里,比如说,decompiler反编译软件,在Marketplace里。好了,就先到这里了,别的明天再说吧。
然后上课,老师讲了一下昨天的东西,Arrays.sort(list4,String.CASE_INSENSITIVE_ORDER); 是按字母表排序, Arrays.sort(list5,Collections.reverseOrder()); 是降序排序,
Arrays.sort(list5, new Comparator<Integer>() { //自定义排序
@Override
public int compare(Integer o1, Integer o2) {
// TODO Auto-generated method stub
return (o2-o1);
}
});
还有选择文件:JFileChooser fileChooser = new JFileChooser();
if(fileChooser.showOpenDialog(null)==JFileChooser.APPROVE_OPTION) {
File file1 = fileChooser.getSelectedFile();
Scanner input = new Scanner(file1);
while(input.hasNext()) {
System.out.println(input.nextLine());
}
input.close();
} else {
System.out.println("No file selected");
}
然后还讲了集合,有八个好像。。:
public void arrayList() {
//添加有序,有索引 可重复
ArrayList<String> list = new ArrayList<>();
}
public void linkedList() {
LinkedList<String> list = new LinkedList<>();
}
public void vector() { //线程安全的,不能同时访问。
Vector<String> vt = new Vector<>();
}
public void hashSet() {
HashSet<String> s1 = new HashSet<>();//不能有重复数据。。。没有索引号,内容有序非添加顺序
Iterator<String> it = s1.iterator();
while(it.hasNext()) {
String str = it.next();
}
}
public void treeSet() {
TreeSet<String> t = new TreeSet<>();//用compareto来排序的,可以重写compareto方法
}
public static void hashMap() {
HashMap<String,String> m = new HashMap<>();//先键后值 code根据键来定
m.put("0", "00");
System.out.println(m.remove("0"));//key值不能重复
m.get("0");
for(Entry<String,String> a : m.entrySet()) {
}
for(String ss: m.keySet()) {
}
for(String ss:m.values()) {
}
}
public static void hashTable() {
Hashtable<String,String> m2 = new Hashtable<>();//线程安全
}
public static void treeMap() {
TreeMap<String,String> m3 = new TreeMap<>();//自定义排序
}
然后今天晚上看了一下继承和多态,通过父类实现动态绑定,用到instanceof,还看了字节转化为字符的方法,先解码在编码,
String str = "ddddssffae";
byte[] bytes;
try {
bytes = str.getBytes("utf-8");
System.out.println(Arrays.toString(bytes));
String str1 = new String(bytes,"utf-8");
System.out.println(str1);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
别的好像也没有什么了,那就结束吧,但是又想起了什么,myeclipse的插件问题,在help里,比如说,decompiler反编译软件,在Marketplace里。好了,就先到这里了,别的明天再说吧。
相关文章推荐
- Study Plan - The Thirteenth Day
- The Day You Went Away
- The Secret DAILY TEACHINGS-Day 44
- the first day
- USACO--Friday the Thirteenth
- waiting for the day
- DP入门 the 1st day
- The Secret DAILY TEACHINGS-Day 51
- The Sunny Day
- #Sample of the Day 检查文件是否被使用
- Friday the Thirteenth(USACO)
- USACO1.1 Friday the Thirteenth 比较分析
- The First Day of My Life
- The first day
- The last day of 2015
- The last day of 5.1
- UVALive 4370 A Day at the Races
- 关于Tip of the Day
- USACO 1.1 Friday the Thirteenth
- Study Plan - The Twentieth Day