JDK 自带的序列化,只需实现java.io.Serializable接口即可。比如下面的Student类 @NoArgsConstructor@AllArgsConstructor@Getter@Builder@ToStringpublicclassStudentimplementsSerializable{privatestaticfinallongserialVersionUID=1905122041950251207L;privateString name;privatetransientInteger age;privateString address; } pr...
System.out.println(s1 == s2);//trueSystem.out.println(s1 == s3);//falseSystem.out.println(s1 == s4);//falseSystem.out.println(s3 == s4);//false2.3面试题Strings=newString("abc");方式创建对象,在内存中创建了几个对象? 两个:一个是堆空间中new结构,另一个是char[]对应的常量池中的数据...
lists/sets:List/Set 集合工具对象,常用的方法有:toList、size、isEmpty、contains、containsAll 和 sort 等; maps:Map 集合工具对象,常用的方法有:size、isEmpty、containsKey 和 containsValue 等; dates:日期工具对象,常用的方法有:format、year、month、hour 和 createNow 等。 使用内置工具对象 strings 的 equal...
Cloud Studio代码运行 publicTankcreateTank(String check){Tank tank=null;if(Objects.equals(check,"my")){tank=newMyTank();}elseif(Objects.equals(check,"mouse")){tank=newMouseTank();}elseif(Objects.equals(check,"big")){tank=newBigTank();}else{thrownewUnsupportedOperationException("unsupport");...
for(User user: userList) {for(Role role: roleList) {if(user.getRoleId().equals(role.getId())) {user.setRoleName(role.getName());}}} 这个例子中有两层循环,如果 userList 和 roleList 数据比较多的话,需要循环遍历很多次,才能获取我们所需要的...
where is one of: <none> to print same info as Solaris pmap -heap to print java heap summary -histo[:live] to print histogram of java object heap; if the "live" suboption is specified, only count live objects -clstats to print class loader statistics -finalizer...
第一阶段:主要是解析调用的参数,即argv[],通过for循环遍历解析,通过string的方法来判断,主要出是初始化startSystemServer、abiList和socketName变量 第二阶段:调用registerZygoteSocket(socketName)方法注册Zygote的socket监听接口,用来启动应用程序的消息 第三阶段:调用preload()方法装载系统资源,包括系统预加载类、Framework...
创建空集合 Collections.emptyList(); 创建单元素集合 Collections.singletonList("apple"); 排序Collections.sort(list); 创建不可变集合 Collections.unmodifiableList(mutable); 创建线程安全集合 Collections.synchronizedList(list); ... Guava 沿着 Collections 的思路 提供了 更多的工具方法,适用于所有集合的静态方法,...
JDK-8081771core-libsProcessTool.createJavaProcessBuilder() needs new addTestVmAndJavaOptions argument JDK-8059677core-libsjava.langThread.getName() instantiates Strings JDK-8149330core-libsjava.langCapacity of StringBuilder should not get close to Integer.MAX_VALUE unless necessary ...
On Windows, the ProcessBuilder has expanded the quoting of argument strings when starting a process to ensure they are recognized by the application as a single command argument. The set of space characters has been expanded from space (0x20) to include all space characters as defined by java....