Skip to content
Permalink
Browse files

Primo commit dei sorgenti

  • Loading branch information...
daitangio committed Aug 31, 2019
1 parent 3945c24 commit b90a6ade8bc258b0b4cc00bf9f7ff048bd5b4300
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="output" path="classes"/>
</classpath>
@@ -0,0 +1,6 @@
# use glob syntax.
syntax: glob

glob:classes/*
glob:*.class

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>JavaCaching</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5
@@ -0,0 +1,38 @@
package com.gioorgi.cache;

import java.util.HashMap;
import java.util.Map;

public final class SimpleCache {

private static SimpleCache singleton;

Map<String,Object> cache= new HashMap<String,Object>();

private SimpleCache(){

}

public static SimpleCache getInstance(){
if(singleton==null){
singleton= new SimpleCache();
}
return singleton;

}


public Object get(String k){
return cache.get(k);
}

/**
*
* @param k
* @param v
* @return il valore precedente
*/
public Object put(String k, Object v){
return cache.put(k, v);
}
}
@@ -0,0 +1,39 @@
package com.gioorgi.cache;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public final class SimpleCache2 {

private static SimpleCache2 singleton;

Map<String,Object> cache= Collections.synchronizedMap(new HashMap<String,Object>());

private SimpleCache2(){

}

public static SimpleCache2 getInstance(){
if(singleton==null){
singleton= new SimpleCache2();
}
return singleton;

}


public Object get(String k){
return cache.get(k);
}

/**
*
* @param k
* @param v
* @return il valore precedente
*/
public Object put(String k, Object v){
return cache.put(k, v);
}
}

0 comments on commit b90a6ad

Please sign in to comment.
You can’t perform that action at this time.