这里通过一个DEMO介绍反射配合抽象工厂模式的运用。大概业务背景就是在实际业务过程中,可能要替换数据库,具体代码如下:1、User实体类class User { private int id; private string name; public i...
分类:
其他好文 时间:
2015-03-18 23:01:53
阅读次数:
239
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2015-03-18 22:59:37
阅读次数:
170
public class Algorithm {
public static void main(String[] args) {
long t1 = System.currentTimeMillis();
for (int i = -10000000; i < 10000000; i++) {
countOne(i);
}
long t2 = System.curren...
分类:
其他好文 时间:
2015-03-18 21:47:35
阅读次数:
160
WordBreak题目Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, given
s = “leetcode”,
dict = [...
分类:
其他好文 时间:
2015-03-18 21:46:10
阅读次数:
127
实现两个集合的差:#include"iostream"#include"stdio.h"#include"algorithm"#include"string.h"#include"cmath"#define maxsize 100using namespace std;typedef int dat...
分类:
其他好文 时间:
2015-03-18 20:30:15
阅读次数:
152
assets文件夹资源的访问 assets文件夹里面的文件都是保持原始的文件格式,需要用AssetManager以字节流的形式读取文件。 1. 先在Activity里面调用getAssets()来获取AssetManager引用。 2. 再用AssetManager的open(String ...
分类:
编程语言 时间:
2015-03-18 20:23:56
阅读次数:
175
在不知道长度的前提下查找链表的中间节点:#include"iostream"#include"stdio.h"#include"algorithm"#include"string.h"#include"cmath"#define maxsize 100using namespace std;type...
分类:
其他好文 时间:
2015-03-18 20:21:13
阅读次数:
142
pakeage dao.Impl;//调用函数FUN_GET();public String get(String Id,String Name){return getSession().createSQLQuery("select FUN_GET(?,?) from dual") .setP...
分类:
数据库 时间:
2015-03-18 20:14:51
阅读次数:
170
1编写帮助类根绝url得到jsonpublic static string Post(string url) { string strURL = url; //创建一个HTTP请求 HttpWebRequest re...
分类:
Web程序 时间:
2015-03-18 20:04:17
阅读次数:
153
namespace DelegateTest{ delegate bool FilterDelegate(int i); //声明委托,参数类型,返回类型,委托名称。 class Program { static void Main(string[] args) { int[] array = { ...
分类:
其他好文 时间:
2015-03-18 20:03:03
阅读次数:
138