单例模式有以下特点:
1、单例类只能有一个实例。
2、单例类必须自己创建自己的唯一实例。
3、单例类必须给所有其他对象提供这一实例
方式一、懒汉式单例,线程不安全public class SingleOne {
//懒汉式单例,线程不安全
private static SingleOne single = null;
private SingleOne(){}//设置...
分类:
编程语言 时间:
2015-07-11 16:48:00
阅读次数:
129
题意:数组中每个数字都出现了两次,只有一个出现一次,找出这个数思路:很明显不能从头到位遍历来找,首先是超时的原因,再次就是这样很没意思·····但是却没想到什么好办法,因为不了解按位异或(XOR)。异或就是相同的两个数结果为0,不同的为1。根据交换律我们知道,数组中两两异或的结果就剩最后那一个落单的...
分类:
其他好文 时间:
2015-07-11 11:54:07
阅读次数:
91
最近开始写博客了,把我学习到的东西进行汇总和总结,今天就说说怎么使用sqlite3来操纵数据库吧 数据库的相关知识我就不去说明了,毕竟只要会sql语言的人就大家都一样。 本案例是在Xcode环境下创建的single view application进行演示操作,如有不清楚的朋友可以找我...
分类:
数据库 时间:
2015-07-11 11:49:49
阅读次数:
281
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ...
分类:
其他好文 时间:
2015-07-10 20:41:50
阅读次数:
131
136 Single Number链接:https://leetcode.com/problems/single-number/
问题描述:
Given an array of integers, every element appears twice except for one. Find that single one.Note:
Your algorithm should hav...
分类:
其他好文 时间:
2015-07-09 14:34:47
阅读次数:
92
不论什么类型的网站,到达一定规模之后一定会存在这样的问题:比如我们有N个系统,传统方式下我们就需要有N对不同的用户名和密码,本来这些系统的开发都能为我们带来良好的效益,用户在用的时候并不方便,每次都需要输入不同的用户名和密码进行身份验证。特别是应用系统较多,用户数目也很多的企业这个问题尤为突出。问题的出现并不是因为我们系统开发出现问题,而是缺少一个同一的用户管理平台。
S...
分类:
其他好文 时间:
2015-07-09 09:41:37
阅读次数:
153
以下两个题目来源于Leetcode:1.Single numberGiven an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm sho...
分类:
其他好文 时间:
2015-07-08 18:12:34
阅读次数:
114
DescriptionThe official capital and the cultural capital of Berland are connected by a single road running throughnregions. Each region has a unique c...
分类:
其他好文 时间:
2015-07-07 21:00:58
阅读次数:
117