自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(408)
  • 资源 (2)
  • 收藏
  • 关注

原创 线程池

JAVA线程池的实现使用线程池的好处降低资源消耗提高响应速度提高线程的可管理性Executor框架作用:线程工厂,可以通过Executors创建特定功能的线程池。线程池的种类1. newFixedThreadPool(num)固定数量的线程池,线程池中只存在核心线程,线程池中的核心线程数等于最大线程数,当有新的任务来临时不会开辟新的线程来处理任务...

2018-07-16 22:12:37 1220

原创 ClassLoader简介

**作用:**ClassLoader是用来动态加载class文件到内存中。JAVA默认提供三个classLoaderBootStrap ClassLoader:启动类加载器,负责加载JDK中的核心类库。Extension ClassLoader:扩展类加载器,负责加载JAVA的扩展类库。App ClassLoader: 系统类加载器, 加载应用程序classpath目录下的所有j...

2018-07-03 22:44:59 558

原创 垃圾收集器(垃圾收集算法的实现)

Serial收集器单线程垃圾收集器,在其进行垃圾收集的时候需要暂停其他的线程。 Serial收集器是Client模式下的默认新生代垃圾收集器。 ParNew收集器Serial收集器的多线程版本,是Server模式下默认新生代垃圾收集器。 Parallel Scavenge收集器新生代垃圾收集器 ,使用的算法是复制算法,也是并行多线程收集器。和ParNew的区别是,Pa...

2018-07-03 21:44:59 466

原创 垃圾回收算法(内存回收的方法论)

1.引用计数法对对象设置一个引用计数器,每增加一个变量对它的引用计数器就加1。每减少一个引用,计数器就减1。当对象的引用计数器变为0时,该对象才会被回收。 缺陷:1.频繁的对引用进行加减操作会增加系统的消耗2.会产生循环引用导致内存泄漏。2.标记清除法将垃圾回收分成两个阶段:标记阶段和清除阶段。通过标记从根节点开始可达的对象,未被标记的就是未被引用的垃圾对象。清除阶段是清除未被标记的...

2018-07-03 21:28:07 690

转载 Jpa中ManyToMany和OneToMany的双向控制

Jpa中ManyToMany和OneToMany的双向控制下面我们使用权限管理中Role<->Account(用户ManyToMany账号)、Role<->Domain(用户OneToMany权限域)的关系来举例。    1、ManyToMany Account表 在两个表的对应属性上添加JoinColumns和inverseJoinColumns...

2018-06-05 20:39:28 639

原创 167. Two Sum II - Input array is sorted

Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function twoSum should return indices of t...

2018-04-10 10:35:22 193

原创 137. Single Number II

Given an array of integers, every element appears three times except for one, which appears exactly once. Find that single one. Note: Your algorithm should have a linear runtime com...

2018-04-10 10:23:25 361

原创 136. Single Number

Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it wi...

2018-04-10 09:12:21 166

转载 shell脚本定时重启tomcat

crond 是linux用来定期执行程序的命令,我们通过crond来定期执行shell脚本重启tomcat。下面我以CentOS release 6.3(版本查看cat /etc/issue)为例详细描述一下操作步骤:1、编写shell脚本 vi restart_cat.sh#!/bin/sh . /etc/profile pid=`ps aux | grep tom...

2018-04-08 10:11:07 1126

原创 400. Nth digit

在无限的整数序列 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, …中找到第 n 个数字。 注意: n 是正数且在32为整形范围内 ( n < 231)。 示例 1: 输入: 3 输出: 3 示例 2: 输入: 11 输出: 0 说明: 第11个数字在序列 1,...

2018-04-02 09:18:23 1099

原创 53 Maximum Subarray

给定一个序列(至少含有 1 个数),从该序列中寻找一个连续的子序列,使得子序列的和最大。 例如,给定序列 [-2,1,-3,4,-1,2,1,-5,4], 连续子序列 [4,-1,2,1] 的和最大,为 6。 扩展练习: 若你已实现复杂度为 O(n) 的解法,尝试使用更为精妙的分治法求解。解题思路: 边界: dp[0] = nums[0]...

2018-04-01 20:56:13 163

原创 103. 二叉树的锯齿形层次遍历

计算给定二叉树的所有左叶子之和。 示例: 在这个二叉树中,有两个左叶子,分别是 9 和 15,所以返回 24 3 / \ 9 20 / \ 15 7解题思路: 层序遍历,当一个节点的左节点存在,并且该左节点为叶子节点,则将它的值累加。/** * Definition for a binary tree n...

2018-03-26 17:21:21 712 1

原创 155. Min Stack

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) – Push element x onto stack. pop() – Removes the element on top of the stack. top

2018-03-24 18:19:00 1058

原创 21. Merge Two Sorted Lists

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Example: Input: 1->2->4, 1->3-...

2018-03-21 16:14:42 169

原创 142. Linked List Cycle II

Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Note: Do not modify the linked list. Follow up: Can you solve it without using ext...

2018-03-21 15:50:13 426

原创 75. Sort Colors

Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue. Here, we will use ...

2018-03-21 15:09:10 179

原创 8. String to Integer (atoi)

Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the poss...

2018-03-21 14:33:30 173

原创 70. Climbing Stairs

You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Note: Given n wi...

2018-03-20 15:42:43 173

原创 225. Implement Stack using Queues

Implement the following operations of a stack using queues. push(x) – Push element x onto stack. pop() – Removes the element on top of the stack. top() – Get the top element. ...

2018-03-20 15:25:54 168

原创 232. Implement Queue using Stacks

Implement the following operations of a queue using stacks. push(x) – Push element x to the back of queue. pop() – Removes the element from in front of queue. peek() – Get the fr...

2018-03-20 15:08:57 157

原创 88. Merge Sorted Array

Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note: You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additio...

2018-03-20 14:16:19 141

原创 递归解析json数据,并将数据的路径与对应value存入map中

public static void analysisJson(Object objJson, String path, Map<String, String> map) { // 如果obj为json数组 if (objJson instanceof JSONArray) { JSONArray objA...

2018-03-20 09:41:21 3461 8

原创 JSONNull的判断问题

最近遇到一个问题,将一个JSON对象解析,封装到一个类中。JSON对象String data = "[{'id':73,'applyDate':'2018-03-05','reason':'123','auditState':'待审批','editable':false,'applicantUserName':'admin'," + "'applican...

2018-03-16 09:23:48 12889 1

原创 62. Unique Paths

A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the bo...

2018-03-13 09:56:32 144

原创 96. Unique Binary Search Trees

Given n, how many structurally unique BST’s (binary search trees) that store values 1…n? For example, Given n = 3, there are a total of 5 unique BST’s. 1 3 3 2...

2018-03-13 09:53:50 159

原创 120. Triangle

Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the following triangle [ [2],...

2018-03-13 09:51:15 139

原创 486. Predict the Winner

Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each time a player...

2018-03-13 09:48:10 127

原创 279. Perfect Squares

Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, …) which sum to n. For example, given n = 12, return 3 because 12 = 4 + 4 + 4; gi...

2018-03-13 09:35:27 151

原创 64. Minimum Path Sum

Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. Note: You can only move either down o...

2018-03-13 09:30:42 122

原创 152. Maximum Product Subarray

Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2,4], the contiguous subarray [2,3] h...

2018-03-13 09:26:23 177

原创 718. Maximum Length of Repeated Subarray

Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays. Example 1: Input: A: [1,2,3,2,1] B: [3,2,1,4,7] Output: 3 Explana...

2018-03-13 09:23:38 124

原创 300. Longest Increasing Subsequence

Given an unsorted array of integers, find the length of longest increasing subsequence. For example, Given [10, 9, 2, 5, 3, 7, 101, 18], The longest increasing subsequence is [2,...

2018-03-13 09:19:04 134

原创 650. 2 Keys Keyboard

Initially on a notepad only one character ‘A’ is present. You can perform two operations on this notepad for each step: Copy All: You can copy all the characters present on the notepad (p...

2018-03-13 09:14:16 187

原创 213. House Robber II

Note: This is an extension of House Robber. After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This t...

2018-03-13 09:09:34 155

原创 198. House Robber

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjace...

2018-03-13 09:02:04 142

原创 查找最长回文子序列

解题思路: dp[i][j]表示字符串索引从i~j之间是否为最长回文子序列(长度) 状态转移方程dp[i][j] = dp[i+1][j-1]+1 if(str[i]==str[j]) max(dp[i+1][j],dp[i][j-1]) if(str[i]!=str[j])边界dp[i][i] = 1dp[i...

2018-03-13 08:58:43 463

原创 740. Delete and Earn

Given an array nums of integers, you can perform operations on the array. In each operation, you pick any nums[i] and delete it to earn nums[i] points. After, you must delete every elemen...

2018-03-13 08:48:51 160

原创 377. Combination Sum IV

Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target. Example: nums = [1, 2, 3] t...

2018-03-12 22:52:02 140

原创 322. Coin Change

You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount o...

2018-03-12 22:07:37 205

原创 714. Best Time to Buy and Sell Stock with Transaction Fee

Your are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee representing a transaction fee. You may compl...

2018-03-12 22:03:23 149

wpf事件参考

wpf事件参考,个人感觉挺有用的,希望对大家有帮助!

2012-09-27

WPF控件参考

WPF控件参考,个人感觉挺不错的,希望对大家有帮助!

2012-09-27

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除