Posts

Showing posts from October, 2015

Collection holds value as a refernce in java

Value as a Reference example : Here we are fecthing a list from a collection and updating this which leads to automatic update of Map because numList is directly referring to  testmap.
-----------------------------------


public class ValueAsReference{

enum EvenOdd{
EVEN,ODD
}
public static void main(String ... arg){

Map<String,List<String>> testmap=new HashMap<String, List<String>>();
for(int i=0;i<20;i++){
String key="";
if(i%2 ==0){
key=""+EvenOdd.EVEN;

}else{
key=""+EvenOdd.ODD;
}
List<String> numList=testmap.get(key);

if(numList==null){
numList=new ArrayList<String>();
numList.add("i="+i);
testmap.put(key, numList);
}else{
numList.add("i="+i);
}
}
for(String key : testmap.keySet()){
System.out.println("key : "+key);
System.out.println(testmap.get(key));
}

}
}
--------------------------------------
Output :
key : EVEN
[i=0, i=2, i=4, i=6, i=8, i=10, i=12, i=14, i=16, i=18]
key : ODD
[i=1, i=3, i=5, i=7, i=9, i…

Google App Engine deleted default GCS bucket. Is there a way to restore it?

No, there is no way to restore a deleted bucket or object inside a bucket. DELETE operation comes under strong global consistency. Keep in mind that you can use Google Cloud Storage only after enabling billing for your project. It's not free.

You can go through Cloud storage documentation

Bucket will be deleted permanently. You can see google documentation. Although a bucket will be deleted only if it is empty, means you have to delete all objects first and then you can delete an empty bucket. Choose bucket carefully as these are unique globally and can not be nested like folders or directories.