泛型方法的定义 /** * 泛型参数的无返回值方法 * * 1、public 与 返回值中间<T>非常重要,可以理解为声明此方法为泛型方法。 * 2、只有声明了<T>的方法才是泛型方法,泛型类中的使用了泛型的成员方法并不是泛型方法。 * 3、<T>表明该方法将使用泛型类型T,此时才可以在方法中使用泛 ...
分类:
其他好文 时间:
2021-04-20 14:34:49
阅读次数:
0
1.饿汉式,这种方式不推荐,会造成资源的浪费。 public class Hungry { private Hungry(){ } private static Hungry hungry = new Hungry(); public static Hungry getInstance(){ ret ...
分类:
其他好文 时间:
2021-04-20 14:07:56
阅读次数:
0
public class Main { public static void main(String[] args) { test test = new test(); test.xxx(new zi()); } } class fu{ public void x(){ System.out.pri ...
分类:
其他好文 时间:
2021-04-20 14:06:09
阅读次数:
0
public class StatePattern { public static void main(String[] args) { Context context=new Context(); for (int i = 0; i < 10; i++) { context.handle(); } ...
分类:
其他好文 时间:
2021-04-19 16:06:54
阅读次数:
0
解决属性名和字段名不一致的问题 1.出现的问题 数据库中的字段 ? 新建一个项目,拷贝之前的,测试实体类与数据库字段不一致的情况 public class User { private int id; private String name; private String password; } 现 ...
分类:
其他好文 时间:
2021-04-19 16:03:47
阅读次数:
0
生成RSA密钥 1. 制作密钥对 [root@host ~]$ ssh-keygen <== 建立密钥对 Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): ...
分类:
系统相关 时间:
2021-04-19 15:54:27
阅读次数:
0
滑动窗口 219. 存在重复元素 II 给定一个整数数组和一个整数 k,判断数组中是否存在两个不同的索引 i 和 j,使得 nums [i] = nums [j],并且 i 和 j 的差的 绝对值 至多为 k。 // 滑动窗口做法 class Solution { public boolean co ...
分类:
其他好文 时间:
2021-04-19 15:40:01
阅读次数:
0
难度 medium 找出所有相加之和为 n 的 k 个数的组合。组合中只允许含有 1 - 9 的正整数,并且每种组合中不存在重复的数字。 说明: 所有数字都是正整数。 解集不能包含重复的组合。 示例 1: 输入: k = 3, n = 7 输出: [[1,2,4]] 示例 2: 输入: k = 3, ...
分类:
其他好文 时间:
2021-04-19 15:38:38
阅读次数:
0
方法如下: public string Base64StringToFile(string base64String, string fileName) { //文件后缀 string suffix = ""; try { //文件保存路径 string fileFullPath = @"C:\Us ...
翻转一棵二叉树。 示例: 输入: 4 / \ 2 7 / \ / \1 3 6 9输出: 4 / \ 7 2 / \ / \9 6 3 1 来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/invert-binary-tree著作权归领扣网络所有。 ...
分类:
其他好文 时间:
2021-04-19 14:42:03
阅读次数:
0