本文整理匯總了Java中java.util.Hashtable.values方法的典型用法代碼示例。如果您正苦於以下問題:Java Hashtable.values方法的具體用法?Java Hashtable.values怎麽用?Java Hashtable.values使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.Hashtable
的用法示例。
在下文中一共展示了Hashtable.values方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getCreatedFonts
import java.util.Hashtable; //導入方法依賴的package包/類
public Font[] getCreatedFonts() {
Hashtable<String,Font2D> nameTable;
if (fontsAreRegistered) {
nameTable = createdByFullName;
} else if (fontsAreRegisteredPerAppContext) {
AppContext appContext = AppContext.getAppContext();
nameTable =
(Hashtable<String,Font2D>)appContext.get(regFullNameKey);
} else {
return null;
}
Locale l = getSystemStartupLocale();
synchronized (nameTable) {
Font[] fonts = new Font[nameTable.size()];
int i=0;
for (Font2D font2D : nameTable.values()) {
fonts[i++] = new Font(font2D.getFontName(l), Font.PLAIN, 1);
}
return fonts;
}
}
示例2: distFeaturesOnClients
import java.util.Hashtable; //導入方法依賴的package包/類
public int[] distFeaturesOnClients() {
Hashtable<SGHFeature, Integer> count = new Hashtable<SGHFeature, Integer>();
for (SGHClientApp c : clients) {
for (SGHFeature f : c.featureSet) {
if (!count.containsKey(f)) {
count.put(f, 1);
}
else {
count.put(f, count.get(f) + 1);
}
}
}
ArrayList<Integer> counts = new ArrayList<Integer>(count.values());
Collections.sort(counts);
int[] result = new int[counts.size()];
for (int i=0; i<counts.size(); i++) result[counts.size()-i-1] = counts.get(i);
return result;
}
示例3: distFeaturesOnServers
import java.util.Hashtable; //導入方法依賴的package包/類
public int[] distFeaturesOnServers() {
Hashtable<SGHFeature, Integer> count = new Hashtable<SGHFeature, Integer>();
for (SGHServer s : servers) {
for (SGHFeature f : s.featureSet) {
if (!count.containsKey(f)) {
count.put(f, 1);
}
else {
count.put(f, count.get(f) + 1);
}
}
}
ArrayList<Integer> counts = new ArrayList<Integer>(count.values());
Collections.sort(counts);
int[] result = new int[counts.size()];
for (int i=0; i<counts.size(); i++) result[counts.size()-i-1] = counts.get(i);
return result;
}
示例4: getCreatedFontFamilyNames
import java.util.Hashtable; //導入方法依賴的package包/類
public TreeMap<String, String> getCreatedFontFamilyNames() {
Hashtable<String,FontFamily> familyTable;
if (fontsAreRegistered) {
familyTable = createdByFamilyName;
} else if (fontsAreRegisteredPerAppContext) {
AppContext appContext = AppContext.getAppContext();
@SuppressWarnings("unchecked")
Hashtable<String,FontFamily> tmp =
(Hashtable<String,FontFamily>)appContext.get(regFamilyKey);
familyTable = tmp;
} else {
return null;
}
Locale l = getSystemStartupLocale();
synchronized (familyTable) {
TreeMap<String, String> map = new TreeMap<String, String>();
for (FontFamily f : familyTable.values()) {
Font2D font2D = f.getFont(Font.PLAIN);
if (font2D == null) {
font2D = f.getClosestStyle(Font.PLAIN);
}
String name = font2D.getFamilyName(l);
map.put(name.toLowerCase(l), name);
}
return map;
}
}
示例5: getCreatedFonts
import java.util.Hashtable; //導入方法依賴的package包/類
public Font[] getCreatedFonts() {
Hashtable<String,Font2D> nameTable;
if (fontsAreRegistered) {
nameTable = createdByFullName;
} else if (fontsAreRegisteredPerAppContext) {
AppContext appContext = AppContext.getAppContext();
@SuppressWarnings("unchecked")
Hashtable<String,Font2D> tmp =
(Hashtable<String,Font2D>)appContext.get(regFullNameKey);
nameTable = tmp;
} else {
return null;
}
Locale l = getSystemStartupLocale();
synchronized (nameTable) {
Font[] fonts = new Font[nameTable.size()];
int i=0;
for (Font2D font2D : nameTable.values()) {
fonts[i++] = new Font(font2D.getFontName(l), Font.PLAIN, 1);
}
return fonts;
}
}
示例6: dispose
import java.util.Hashtable; //導入方法依賴的package包/類
/**
* Unbinds all character pixmaps of this font.
*/
public void dispose()
{
Hashtable<ITexture, ITexture> set = new Hashtable<ITexture, ITexture>();
for(Pixmap p: texHashMap.values())
set.put(p.getTexture(), p.getTexture());
for(ITexture t: set.values())
t.dispose();
}
示例7: main
import java.util.Hashtable; //導入方法依賴的package包/類
public static void main(String[] args) {
//create Hashtable object
Hashtable ht = new Hashtable();
//add key value pairs to Hashtable
ht.put("1", "One");
ht.put("2", "Two");
ht.put("3", "Three");
/*
get Collection of values contained in Hashtable using
Collection values() method of Hashtable class
*/
Collection c = ht.values();
System.out.println("Values of Collection created from Hashtable are :");
//iterate through the collection
Iterator itr = c.iterator();
while (itr.hasNext()) System.out.println(itr.next());
/*
Please note that resultant Collection object is backed by the Hashtable.
Any value that is removed from Collection will also be removed from
original Hashtable object. The same is not the case with the element
addition.
*/
//remove One from collection
c.remove("One");
//print values of original values of Hashtable
System.out.println("Hashtable values after removal from Collection are :");
Enumeration e = ht.elements();
while (e.hasMoreElements()) System.out.println(e.nextElement());
}
示例8: getCreatedFontFamilyNames
import java.util.Hashtable; //導入方法依賴的package包/類
public TreeMap<String, String> getCreatedFontFamilyNames() {
Hashtable<String,FontFamily> familyTable;
if (fontsAreRegistered) {
familyTable = createdByFamilyName;
} else if (fontsAreRegisteredPerAppContext) {
AppContext appContext = AppContext.getAppContext();
familyTable =
(Hashtable<String,FontFamily>)appContext.get(regFamilyKey);
} else {
return null;
}
Locale l = getSystemStartupLocale();
synchronized (familyTable) {
TreeMap<String, String> map = new TreeMap<String, String>();
for (FontFamily f : familyTable.values()) {
Font2D font2D = f.getFont(Font.PLAIN);
if (font2D == null) {
font2D = f.getClosestStyle(Font.PLAIN);
}
String name = font2D.getFamilyName(l);
map.put(name.toLowerCase(l), name);
}
return map;
}
}
示例9: buildMovieFromCursor
import java.util.Hashtable; //導入方法依賴的package包/類
public static List<MovieTags> buildMovieFromCursor(Cursor cur) {
Hashtable<Long, MovieTags> tags = new Hashtable<Long, MovieTags>();
if(DBG) Log.d(TAG, "Building MovieTags from Cursor");
if(!cur.moveToFirst())
return null;
do {
Long id = Long.valueOf(getLongCol(cur, ScraperStore.Movie.ID));
String name = getStringCol(cur, ScraperStore.Movie.NAME);
float rating = getFloatCol(cur, ScraperStore.Movie.RATING);
int year = getIntCol(cur, ScraperStore.Movie.YEAR);
String plot = getStringCol(cur, ScraperStore.Movie.PLOT);
String cover = getStringCol(cur, ScraperStore.Movie.COVER);
String actorName = getStringCol(cur, ScraperStore.Movie.Actor.NAME);
String role = getStringCol(cur, ScraperStore.Movie.Actor.ROLE);
String director = getStringCol(cur, ScraperStore.Movie.Director.NAME);
String genre = getStringCol(cur, ScraperStore.Movie.Genre.NAME);
String studio = getStringCol(cur, ScraperStore.Movie.Studio.NAME);
String backdropUrl = getStringCol(cur, ScraperStore.Movie.BACKDROP_URL);
String backdropPath = getStringCol(cur, ScraperStore.Movie.BACKDROP);
MovieTags tag = tags.get(id);
if(tag == null) {
tag = new MovieTags();
tags.put(id, tag);
}
tag.setId(id.longValue());
tag.setTitle(name);
if(rating >= 0)
tag.setRating(rating);
if(year >= 0)
tag.setYear(year);
tag.setPlot(plot);
if(cover != null)
tag.setCover(new File(cover));
tag.addActorIfAbsent(actorName, role);
tag.addDirectorIfAbsent(director);
tag.addGenreIfAbsent(genre);
tag.addStudioIfAbsent(studio);
if(backdropUrl != null && backdropPath != null) {
ScraperImage image = new ScraperImage(Type.MOVIE_BACKDROP, null);
image.setLargeUrl(backdropUrl);
image.setLargeFile(backdropPath);
tag.setBackdrops(image.asList());
}
} while(cur.moveToNext());
return new ArrayList<MovieTags>(tags.values());
}
示例10: buildShowFromCursor
import java.util.Hashtable; //導入方法依賴的package包/類
public static List<ShowTags> buildShowFromCursor(Cursor cur) {
Hashtable<Long, ShowTags> tags = new Hashtable<Long, ShowTags>();
if(DBG) Log.d(TAG, "Building ShowTags from Cursor");
if(!cur.moveToFirst())
return null;
do {
Long id = Long.valueOf(getLongCol(cur, ScraperStore.Show.ID));
String name = getStringCol(cur, ScraperStore.Show.NAME);
float rating = getFloatCol(cur, ScraperStore.Show.RATING);
long premiered = getLongCol(cur, ScraperStore.Show.PREMIERED);
String plot = getStringCol(cur, ScraperStore.Show.PLOT);
String cover = getStringCol(cur, ScraperStore.Show.COVER);
String actorName = getStringCol(cur, ScraperStore.Show.Actor.NAME);
String role = getStringCol(cur, ScraperStore.Show.Actor.ROLE);
String director = getStringCol(cur, ScraperStore.Show.Director.NAME);
String genre = getStringCol(cur, ScraperStore.Show.Genre.NAME);
String studio = getStringCol(cur, ScraperStore.Show.Studio.NAME);
String backdropUrl = getStringCol(cur, ScraperStore.Show.BACKDROP_URL);
String backdropPath = getStringCol(cur, ScraperStore.Show.BACKDROP);
ShowTags tag = tags.get(id);
if(tag == null) {
tag = new ShowTags();
tags.put(id, tag);
}
tag.setTitle(name);
tag.setId(id.longValue());
if(rating >= 0)
tag.setRating(rating);
if(premiered >= 0)
tag.setPremiered(premiered);
tag.setPlot(plot);
if(cover != null)
tag.setCover(new File(cover));
tag.addActorIfAbsent(actorName, role);
tag.addDirectorIfAbsent(director);
tag.addGenreIfAbsent(genre);
tag.addStudioIfAbsent(studio);
if(backdropUrl != null && backdropPath != null) {
ScraperImage image = new ScraperImage(Type.SHOW_BACKDROP, null);
image.setLargeUrl(backdropUrl);
image.setLargeFile(backdropPath);
tag.setBackdrops(image.asList());
}
} while(cur.moveToNext());
return new ArrayList<ShowTags>(tags.values());
}
示例11: buildEpisodeFromCursor
import java.util.Hashtable; //導入方法依賴的package包/類
public static List<EpisodeTags> buildEpisodeFromCursor(Cursor cur) {
Hashtable<Long, EpisodeTags> tags = new Hashtable<Long, EpisodeTags>();
if(DBG) Log.d(TAG, "Building MovieTags from Cursor");
if(!cur.moveToFirst())
return null;
do {
Long id = Long.valueOf(getLongCol(cur, ScraperStore.Episode.ID));
String name = getStringCol(cur, ScraperStore.Episode.NAME);
float rating = getFloatCol(cur, ScraperStore.Episode.RATING);
long aired = getLongCol(cur, ScraperStore.Episode.AIRED);
String plot = getStringCol(cur, ScraperStore.Episode.PLOT);
int season = getIntCol(cur, ScraperStore.Episode.SEASON);
int number = getIntCol(cur, ScraperStore.Episode.NUMBER);
long show = getLongCol(cur, ScraperStore.Episode.SHOW);
String actorName = getStringCol(cur, ScraperStore.Episode.Actor.NAME);
String role = getStringCol(cur, ScraperStore.Episode.Actor.ROLE);
String director = getStringCol(cur, ScraperStore.Episode.Director.NAME);
String cover = getStringCol(cur, ScraperStore.Episode.COVER);
EpisodeTags tag = tags.get(id);
if(tag == null) {
tag = new EpisodeTags();
tags.put(id, tag);
}
tag.setId(id.longValue());
tag.setTitle(name);
if(rating >= 0)
tag.setRating(rating);
if(aired >= 0)
tag.setAired(aired);
tag.setPlot(plot);
tag.setSeason(season);
tag.setEpisode(number);
tag.setShowId(show);
tag.addActorIfAbsent(actorName, role);
tag.addDirectorIfAbsent(director);
if(cover != null)
tag.setCover(new File(cover));
} while(cur.moveToNext());
return new ArrayList<EpisodeTags>(tags.values());
}