Monday, November 11, 2013

Its one of the design patterns in java.

How It work
You will send a empty object to a method it will full the data in the object and it will return.



Note:
You are sending a empty tanker to method .
Its not a responsibility of method to send tanker and full data.
Only method responsibility is to fill the tanker which ever he got the tank. 
But method wont return any thing if you don't send tanker.

Example 
 public class MemoryInfo{  
  public long availMem;  
  public boolean islowMemory;  
  public long totalMem;  
 }  
 public class Debug{  
  public static getMemoryInfo(MemoryInfo info)  
  {  
  if(null!= info)  
  {  
   info.availMem=10;  
   info.islowMemory=true;  
   info.totalMem=50;  
  }  
  }  
 }  
How to use
 MemoryInfo dbm = new MemoryInfo();  
 Debug.getMemoryInfo(dbm);  
Normally It use in below type API
 BitmapFactory.decodeByteArray  
 FileInputStream.read(byte[])