![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
日常积累
潘荣登
这个作者很懒,什么都没留下…
展开
-
2021-05-26
单例模式之懒加载 /** * @ClassNameLazyTest * @Description 单例模式 懒加载案例 主要实现双重校验锁 * @Author prd * @Date2021/5/26 18:16 * @Version 1.0 **/ public class LazyTest { // 创建一个私有化的静态LazyTest对象lazy private static LazyTest lazy; // 重新构造方法 使其私有化 作用:在其它的地方不能原创 2021-05-26 18:40:27 · 60 阅读 · 0 评论 -
2021-05-26
二分查找 // 资源数组 int[] arr = {1,2,3,4,5,6,7}; 使用资源数组作为二分查找的查找数组 下面是二分查找的具体代码实现 /** * 二分查找法 * @param arr 源数组 * @param key 需要查找元素 * @return 返回的时查找的元素下标 */ public static Integer getIndex(int[] arr,int key){ ...原创 2021-05-26 18:14:15 · 62 阅读 · 0 评论 -
2021-03-15
**如何判断是异步请求还是同步请求** 请求对象 request 响应对象 response HttpServletRequest request, HttpServletResponse response, // 通过得到请求头中的X-Requested-With对象 String header = request.getHeader("X-Requested-With"); // 判断这个对象是否为空来区别这个对象是否是异步还是同步请求 ...原创 2021-03-15 23:08:28 · 48 阅读 · 0 评论 -
模糊查询时间日期
**模糊查询时间日期** 在MySql数据库中,怎样去通过模糊查询时间日期去得到一条表中的数据,代码入下: // 创建一个时间对象 Date date2 = new Date(); // 设置时间格式 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); //获取String类型的时间 String createdate = sdf.format(date2); // 在通过SimpleDateFo...原创 2021-03-15 22:59:05 · 834 阅读 · 0 评论