Remove Multiple Value From Custom ArrayList

Tags

, , ,

HashSet extends AbstractSet and implements the Set interface. It creates a collection that uses a hash table for storage.

A hash table stores information by using a mechanism called hashing. In hashing, the informational content of a key is used to determine a unique value, called its hash code.

The hash code is then used as the index at which the data associated with the key is stored. The transformation of the key into its hash code is performed automatically.

The HashSet class supports four constructors. The first form constructs a default hash set:

HashSet()

The following constructor form initializes the hash set by using the elements of c.

HashSet(Collection c)

The following constructor form initializes the capacity of the hash set to capacity.

The capacity grows automatically as elements are added to the Hash.

HashSet(int capacity)

The fourth form initializes both the capacity and the fill ratio (also called load capacity) of the hash set from its arguments:

HashSet(int capacity,float fillRatio)

If you have person class , you want to get unique person name and make a array then HashSet help you.

boolean add(Object o)
Adds the specified element to this set if it is not already present.

Set<String> titles = new HashSet<String>();

for (int i = 0; i < personList.size(); i++) {

if(titles.add(personList.get(i).getName()))

Here you get only the unique person name . so give you code , What you want.

}

 

<script type=”text/javascript”>
( function() {
if (window.CHITIKA === undefined) { window.CHITIKA = { ‘units’ : [] }; };
var unit = {“publisher”:”solutionexplorer”,”width”:550,”height”:250,”sid”:”Chitika Default”};
var placement_id = window.CHITIKA.units.length;
window.CHITIKA.units.push(unit);
document.write(‘<div id=”chitikaAdBlock-‘ + placement_id + ‘”></div>’);
var s = document.createElement(‘script’);
s.type = ‘text/javascript’;
s.src = ‘//cdn.chitika.net/getads.js’;
try { document.getElementsByTagName(‘head’)[0].appendChild(s); } catch(e) { document.write(s.outerHTML); }
}());
</script>

How to Add AdMob to Your App

AdMob is a service for developers that provides advertisements for your apps.  If you’ve used Android for any amount of time, I’m sure you know that many apps are monetized through small ads displayed in the app.  So the question is, how can you get your own piece of the mobile ad pie?  Well, I’m about to tell you.

import android.content.Context;
import android.widget.LinearLayout;

import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;
import com.mcc.fdc.R;

public class GooglePlayAdmob {
private AdView adView;
public GooglePlayAdmob(Context context, LinearLayout linearLayout) {
adView = new AdView(context);
adView.setAdSize(AdSize.SMART_BANNER);
adView.setAdUnitId(context,”a152dcf32aa86ce”);
linearLayout.addView(adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
}
}