今天研究Java8源码的时候发现了一个神奇的关键字,default,我一直以为default只是在switch里面起作用,其余的就没什么了。然而,知道我看到它作为方法限定符之后我的三观刷新了。。。居然还可以作为权限访问符!
写了几个例子研究一下:
源码1:
public interface DefaultAPI {
public void add(i...
分类:
编程语言 时间:
2015-08-28 19:58:02
阅读次数:
223
public static int magicSlow(int[] array)
{
for(int i=0;i
{
if(array[i]==i)
{
return i;
}
}
return -1;
}
public static int magicFast(int [] array,int start,int end)
{
i...
分类:
编程语言 时间:
2015-08-28 19:55:37
阅读次数:
167
public class PayAction extends BaseAction {
public String JsapiPay(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)throws Exception {
...
分类:
微信 时间:
2015-08-28 19:55:34
阅读次数:
650
/**
* 微信支付jaspi签名
* @param characterEncoding
* @param parameters
* @return
*/
public static String createSign(String characterEncoding,SortedMap parameters){
String API_KEY = PropUtil....
分类:
微信 时间:
2015-08-28 19:54:43
阅读次数:
358
class Solution {
public:
string longestPalindrome(string s) {
string post;
post.resize(s.size()*2+2);
post[0] = '&';
for (int i = 0;i<s.size();i++){
post[2*i + 1] = s[i];
...
分类:
其他好文 时间:
2015-08-28 19:54:27
阅读次数:
140
package com.ods.wx.util;
import java.security.MessageDigest;
/**
* md5签名
* @author pang
*
*/
public class MD5Util {
private static String byteArrayToHexString(byte b[]) {
S...
分类:
微信 时间:
2015-08-28 19:51:47
阅读次数:
554
class RuntimeStringCmp
{
public:
enum cmp_mode
{
normal,
nocase,
};
RuntimeStringCmp(cmp_mode mod=normal):mode(mod)
{
}
~RuntimeStringCmp()
{
}
static bool nocase_compare(char char1...
分类:
编程语言 时间:
2015-08-28 19:49:22
阅读次数:
167
调用wcf public ActionResult Index() { ViewBag.Message = "修改此模板以快速启动你的 ASP.NET MVC 应用程序。"; WCFTestClient wcf=new WCFTestClie...
分类:
Web程序 时间:
2015-08-28 19:42:02
阅读次数:
175
/// /// 坐标轴的最大步长 /// public double MajorStep { get { return axis.CalcIncrement; } set { axis.Incr...
分类:
其他好文 时间:
2015-08-28 19:36:29
阅读次数:
149
https://leetcode.com/problems/valid-anagram/“桶”的思想,通过统计每个字符出现的频率可以得到两个单词是否同构。 1 class Solution { 2 public: 3 bool isAnagram(string s, string t) { ...
分类:
其他好文 时间:
2015-08-28 19:36:26
阅读次数:
167