
java
soybeen
学得越多会的越少
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【数据结构】回溯法--正则表达式匹配算法
public class Pattern { /** * 正则表达式 */ private char[] mPattern; private boolean result = false; /** * 正则表达时长度 */ int mPatternLength; public Pattern(char[...原创 2019-02-16 15:00:31 · 466 阅读 · 1 评论 -
【设计思想】数据的轻量封装
1.今天在做项目的时候,发现一个Bundle数据,因为异步操作的关系,导致了线程不安全修改而崩溃,看了下源码,Bundle,里面的实现是ArrayMap不是线程安全的,如果要解决这个崩溃,要在调用的地方,加锁处理,但是使用的地方太多,很容易加锁错误于是自己就对Bundle,使用装饰模式做了一层简单的封装,public class SaveBundle{ /** * 读...原创 2019-02-16 15:11:36 · 205 阅读 · 0 评论 -
【数据结构】树的查找,插入删除
public class TreeSearchUtils { public static void boundarySearch(TreeNode<Integer> treeNode, int data) { TreeNode<Integer> p = treeNode; while (p != null) { ...原创 2019-01-30 23:01:44 · 363 阅读 · 0 评论 -
【数据结构】堆的应用
public class Heap { private int n = 0; private int count = 0; int[] a;// 从角标1开始存储 public Heap(int n) { this.n = n; this.count = 0; a = new int[n]; } ...原创 2019-02-11 13:54:00 · 222 阅读 · 0 评论 -
【数据结构】动态规划,求矩阵的最短距离
public class DynamicPlan { public static int getMinDis(int[][] matrix, int n) { int[][] state = new int[n][n]; // 初始化,横向 int sum = 0; for (int i = 0; i < n; i++...原创 2019-02-23 14:18:55 · 801 阅读 · 0 评论 -
【拓扑排序】两种拓扑排序算法
public class Graph { /** * 节点数量 */ public int v; public LinkedList<Integer> adj[]; private Graph(int v) { this.v = v; // 初始化顶点 adj = new Link...原创 2019-02-23 15:34:11 · 909 阅读 · 0 评论 -
【数据结构】动态规划--经典算法0-1背包问题
public class DynamicPlay { public static int pack(int[] item, int n, int totalWeight) { // 申请一个状态数组 boolean[] state = new boolean[totalWeight + 1]; // 哨兵作用 state[0...原创 2019-02-18 21:05:39 · 324 阅读 · 0 评论 -
【数据结构】dijkstra算法计算最短路径
package com.example.meitu.data.graph;import android.util.Log;import java.util.LinkedList;/** * @author zpb * Created by meitu on 2019/3/18. * 最短滤镜算法 */public class DijkstraDemoGraph { ...原创 2019-03-18 21:18:58 · 437 阅读 · 0 评论 -
Aop事件注入
package inject;import java.lang.annotation.ElementType;import java.lang.annotation.Retention;import java.lang.annotation.RetentionPolicy;import java.lang.annotation.Target;@Target(ElementType....原创 2019-04-09 20:11:03 · 459 阅读 · 0 评论 -
【数据结构】回溯法--8皇后问题
public class EightQueen { private int[] result = new int[8]; // 第n行 private void calEightQueen(int row) { if (row == 8) { printResult(result); return; ...原创 2019-02-16 14:44:58 · 178 阅读 · 0 评论 -
AnimViewWrapper -- 对view动画的简单包装
public class AnimViewWrapper<T extends View> { T mTarget; public static final int DIRECTION_TOP = 0x01; public static final int DIRECTION_BOTTOM = 0x02; public static final in...原创 2019-01-30 14:34:15 · 282 阅读 · 0 评论 -
学习任务
已经学习待总结:1.性能优化相关总结学习中2.线程知识相关学习和总结待学习:数据结构【正在学习中】java虚拟机opengGl复习学习网络知识 tcp和Https,http,socket,网络加密(已经学习,需要总结)跨进程间通信(AIDL Service(bind),ContentProvider)已经学习RecycleView 源码 :...原创 2019-01-06 16:50:18 · 2084 阅读 · 3 评论 -
仿Recycler Adapter一个数据和UI结合小框架
package com.commsource.uiwrapper;import android.view.View;public abstract class BaseUIDataWrapper<T> { public T data; public ViewHolder holder; protected OnUIGestureListener...原创 2019-01-17 17:19:32 · 142 阅读 · 0 评论 -
【数据结构】排序--3种简单排序
public class SortUtils { /** * 冒泡排序,稳定算法 最好时间复杂度o(1) o(n2) 平均o(n2) * @param a * @param n */ public static void bunbleSort(int[] a, int n) { if (n == 1) { ...原创 2019-01-24 13:48:26 · 259 阅读 · 0 评论 -
【数据结构】排序--归并排序
public class SortUtil { /** * 归并排序采用递归 * @param a * @param n */ public static void Sort(int[] a, int n) { printData(a); mergeSort(a, 0, n - 1); pr...原创 2019-01-24 21:26:03 · 115 阅读 · 0 评论 -
【数据结构】排序--快速排序
public static void quiteSort(int[] a, int low, int high) { if (low > high) { return; } int privot = parttion(a, low, high); quiteSort(a, low, priv...原创 2019-01-25 16:20:02 · 169 阅读 · 0 评论 -
【数据结构】队列--基于数组实现的循环队列
/** * @author zpb 基于数组实现的循环队列 */public class CircleQueue { String[] mQueue; int head = 0; int tail = 0; int mNumber; public CircleQueue(int number) { mQueue = new Str...原创 2019-01-22 14:10:37 · 277 阅读 · 0 评论 -
【数据结构】查找--二分查找
public class SearchUtils { /** * 二分查找 */ public static void boundarySearch(int[] a, int n, int value) { int low = 0; int high = n - 1; while (low <= high)...原创 2019-01-28 14:05:18 · 152 阅读 · 0 评论 -
【数据结构】二分查找拓展
public class BSearchUtils { /** * 二分查找 */ public static void boundarySearch(int[] a, int n, int value) { int low = 0; int high = n - 1; while (low <= high...原创 2019-01-28 20:04:48 · 165 阅读 · 0 评论 -
【数据结构】二叉树---二叉树的三种遍历方法
/** * 先顺遍历,中,左,右 * @param node */ public static void travelTreeFirst(TreeNode node) { if (node == null) { return; } printNode(node); tr...原创 2019-01-30 14:22:57 · 314 阅读 · 0 评论 -
关于google Calendar Instance 的删除问题
1.问题背景:最近遇到一个问题,就是要删除Calendar Event 的Instance,但是在看官方Api,发现 google并没有提供删除Instance的接口,也就是,你只能差而不能删除Instance链接如下:https://developer.android.com/guide/topics/providers/calendar-provider?hl=zh-cn关系图如下:...原创 2019-04-24 21:44:42 · 956 阅读 · 2 评论