Rename multiple files
rename 's/\.htm$/.html/' *.htm
# or
find . -name '*.txt' -print0 | xargs -0 rename 's/.txt$/.xml/'
#Obs1: Above I use regex \. --> literal '.' and $ --> end of line
#Obs2: Use find -maxdepht 'value' for determine how recursive is
#Obs3: Use -print0 to avoid 'names spaces crash!
Friday, July 8, 2011
Friday, July 1, 2011
Collection in Java
Collection is a framework for keeping a group of objects. It is not synchronized. They are basically of two types: list and set. Some of them are ordered while some allow duplicates. List can contain duplicate elements while set cannot
Features of List
- Ordered
- Eg: Arraylist, linkedlist
ArrayList
- positional access : Constant time
- Addition and deletion: Linear time
- positional access : Linear time
- Addition and deletion: Constant time
Features of Set
- Eg. HashSet, TreeSet
HashSet
- Faster but offers no ordering guarantee
- Since the iteration is linear in sum of number of entries and capacity, choosing the size of hashset makes the code faster
If we need to use the operations in SortedSet or if in-order iteration is important to you, use TreeSet.
Since their is no synchronization in Collection, it is generally faster than Hashtable and Vector.
More information is available at following link
Prologue
I have started this blog to maintain accountability of each day. I think this blog will motivate me to do something new everyday and avoid feeling the guilt of wasting the day !!
Subscribe to:
Posts (Atom)