本文整理汇总了Java中java.util.Hashtable.entrySet方法的典型用法代码示例。如果您正苦于以下问题:Java Hashtable.entrySet方法的具体用法?Java Hashtable.entrySet怎么用?Java Hashtable.entrySet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Hashtable
的用法示例。
在下文中一共展示了Hashtable.entrySet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
import java.util.Hashtable; //导入方法依赖的package包/类
public String call() throws Exception {
final StringBuilder sb = new StringBuilder();
final Pattern p = Pattern.compile(Pattern.quote(prefix) + "\\.(\\d+)\\." + Pattern.quote(key)); //NOI18N
final Hashtable<String,Object> props = getProject().getProperties();
for (Map.Entry<String,Object> entry : props.entrySet()) {
Matcher m = p.matcher(entry.getKey());
if (m.matches()) {
final String kv = (String) entry.getValue();
final String valueKey = prefix + '.'+ m.group(1) +'.' + value; //NOI18N
final String vv = getProperty(valueKey, ""); //NOI18N
addProperty(sb,kv,vv);
}
}
for (Map.Entry<String,String> prop : additionalProps.entrySet()) {
addProperty(sb, prop.getKey(), getProperty(prop.getValue(), "")); //NOI18N
}
return sb.toString();
}
示例2: loadData
import java.util.Hashtable; //导入方法依赖的package包/类
private void loadData() {
data.clear();
ArrayList<Attribute> attrs = new ArrayList<Attribute>();
for (Attribute attribute : ATTRIBUTES)
attrs.add(attribute);
// We can use engine.getAttribute(Element, Attribute) method to cat all
// attributes, but this method works match faster for a set of elements.
Hashtable<Element, Object[]> hash = engine.getElements(engine
.getSystemQualifier(Application.QUALIFIER1), attrs);
for (Entry<Element, Object[]> entry : hash.entrySet()) {
data.add(new Row(entry.getKey(), entry.getValue()));
}
Collections.sort(data, new Comparator<Row>() {
@Override
public int compare(Row o1, Row o2) {
if (o1.element.getId() < o2.element.getId())
return -1;
if (o2.element.getId() < o1.element.getId())
return 1;
return 0;
}
});
}
示例3: setupTableElements
import java.util.Hashtable; //导入方法依赖的package包/类
private void setupTableElements() {
List<Attribute> attributes = new ArrayList<Attribute>(1);
attributes.add(StandardAttributesPlugin
.getTableElementIdAttribute(source));
Attribute toSet = StandardAttributesPlugin
.getTableElementIdAttribute(engine);
for (Qualifier q : tableSourceQualifiers) {
Hashtable<Element, Object[]> table = source.getElements(q,
attributes);
for (Entry<Element, Object[]> entry : table.entrySet()) {
Long l = (Long) entry.getValue()[0];
if (l != null) {
Element s = source.getElement(l);
Element d = getDestination(s);
if (d != null) {
Element dest = getDestination(entry.getKey());
engine.setAttribute(dest, toSet, d.getId());
}
}
}
}
}
示例4: loadQualifier
import java.util.Hashtable; //导入方法依赖的package包/类
private CachedQualifier loadQualifier(Long id) {
CachedQualifier q = new CachedQualifier();
q.qualifier = deligate.getQualifier(id);
if (q.qualifier == null)
return null;
List<Attribute> attributes = q.buildAttributes();
q.setAllAttributes(attributes.toArray(new Attribute[attributes.size()]));
Hashtable<Element, Object[]> hashtable = deligate.getElements(
q.qualifier, attributes);
List<CachedElement> elements = q.elements;
for (Entry<Element, Object[]> entry : hashtable.entrySet()) {
Element key = entry.getKey();
CachedElement e = new CachedElement(key, entry.getValue(), q);
elements.add(e);
this.elements.put(key.getId(), e);
}
return q;
}
示例5: UpdateQualifierCommand
import java.util.Hashtable; //导入方法依赖的package包/类
public UpdateQualifierCommand(JournaledEngine engine,
Qualifier oldQualifier, Qualifier newQualifier) {
super(engine);
this.oldQualifier = oldQualifier;
this.newQualifier = newQualifier;
initDeletedAttributes();
for (Attribute attribute : deletedAttributes) {
Hashtable<Element, Transaction> t = engine
.getAttributeWhatWillBeDeleted(oldQualifier.getId(),
attribute.getId());
Hashtable<Long, Transaction> put = new Hashtable<Long, Transaction>();
hashtable.put(attribute.getId(), put);
for (Entry<Element, Transaction> entry : t.entrySet()) {
put.put(entry.getKey().getId(), entry.getValue());
}
}
}
示例6: writeBody
import java.util.Hashtable; //导入方法依赖的package包/类
@Override
public void writeBody(BinaryDataOutput output) throws IOException {
storeQualifier(output, oldQualifier);
storeQualifier(output, newQualifier);
for (Attribute attribute : deletedAttributes) {
Hashtable<Long, Transaction> hash = hashtable
.get(attribute.getId());
output.writeInt(hash.size());
for (Entry<Long, Transaction> entry : hash.entrySet()) {
output.writeLong(entry.getKey());
output.writeInt(entry.getValue().getDelete().size());
for (Persistent p : entry.getValue().getDelete()) {
TransactionStorageCommand
.storePersistent(engine, output, p);
}
}
}
}
示例7: convert
import java.util.Hashtable; //导入方法依赖的package包/类
private Hashtable<Element, Object[]> convert(
Hashtable<Element, List<Persistent>[][]> res,
List<Attribute> attributes) {
AttributeConverter[] converters = new AttributeConverter[attributes
.size()];
for (int i = 0; i < converters.length; i++) {
converters[i] = pluginFactory.getAttributeConverter(attributes.get(
i).getAttributeType());
}
Hashtable<Element, Object[]> hashtable = new Hashtable<Element, Object[]>();
for (Entry<Element, List<Persistent>[][]> entry : res.entrySet()) {
Object[] objects = new Object[converters.length];
for (int i = 0; i < objects.length; i++) {
objects[i] = converters[i].toObject(entry.getValue()[i], entry
.getKey().getId(), attributes.get(i).getId(), this);
}
hashtable.put(entry.getKey(), objects);
}
return hashtable;
}
示例8: readObject
import java.util.Hashtable; //导入方法依赖的package包/类
private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException {
this.map = new VetoableChangeListenerMap();
ObjectInputStream.GetField fields = s.readFields();
@SuppressWarnings("unchecked")
Hashtable<String, VetoableChangeSupport> children = (Hashtable<String, VetoableChangeSupport>)fields.get("children", null);
this.source = fields.get("source", null);
fields.get("vetoableChangeSupportSerializedDataVersion", 2);
Object listenerOrNull;
while (null != (listenerOrNull = s.readObject())) {
this.map.add(null, (VetoableChangeListener)listenerOrNull);
}
if (children != null) {
for (Entry<String, VetoableChangeSupport> entry : children.entrySet()) {
for (VetoableChangeListener listener : entry.getValue().getVetoableChangeListeners()) {
this.map.add(entry.getKey(), listener);
}
}
}
}
示例9: readObject
import java.util.Hashtable; //导入方法依赖的package包/类
private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException {
this.map = new PropertyChangeListenerMap();
ObjectInputStream.GetField fields = s.readFields();
@SuppressWarnings("unchecked")
Hashtable<String, PropertyChangeSupport> children = (Hashtable<String, PropertyChangeSupport>) fields.get("children", null);
this.source = fields.get("source", null);
fields.get("propertyChangeSupportSerializedDataVersion", 2);
Object listenerOrNull;
while (null != (listenerOrNull = s.readObject())) {
this.map.add(null, (PropertyChangeListener)listenerOrNull);
}
if (children != null) {
for (Entry<String, PropertyChangeSupport> entry : children.entrySet()) {
for (PropertyChangeListener listener : entry.getValue().getPropertyChangeListeners()) {
this.map.add(entry.getKey(), listener);
}
}
}
}
示例10: writeHashtable
import java.util.Hashtable; //导入方法依赖的package包/类
/**
* Writes a <code>Hashtable</code> to a <code>DataOutput</code>. Note that even though
* <code>map</code> may be an instance of a subclass of <code>Hashtable</code>,
* <code>readHashtable</code> will always return an instance of <code>Hashtable</code>, <B>not</B>
* an instance of the subclass. To preserve the class type of <code>map</code>,
* {@link #writeObject(Object, DataOutput)} should be used for data serialization.
*
* @throws IOException A problem occurs while writing to <code>out</code>
*
* @see #readHashtable
* @since GemFire 5.7
*/
public static void writeHashtable(Hashtable<?, ?> map, DataOutput out) throws IOException {
InternalDataSerializer.checkOut(out);
int size;
if (map == null) {
size = -1;
} else {
size = map.size();
}
InternalDataSerializer.writeArrayLength(size, out);
if (logger.isTraceEnabled(LogMarker.SERIALIZER)) {
logger.trace(LogMarker.SERIALIZER, "Writing Hashtable with {} elements: {}", size, map);
}
if (size > 0) {
for (Map.Entry<?, ?> entry : map.entrySet()) {
writeObject(entry.getKey(), out);
writeObject(entry.getValue(), out);
}
}
}
示例11: addTagForClosingHBox
import java.util.Hashtable; //导入方法依赖的package包/类
private void addTagForClosingHBox(Hashtable<String, PosLineCol> hashPosLineColByLanguage, Hashtable<String, CMapElement> hashMapsByLanguage)
{
// Enum all Maps in every language and add the item into the map
Set<Entry<String, CMapElement> > set = hashMapsByLanguage.entrySet();
Iterator<Entry<String, CMapElement> > iter = set.iterator();
while(iter.hasNext())
{
Entry<String, CMapElement> entry = iter.next();
String csLg = entry.getKey();
CMapElement eMap = entry.getValue();
PosLineCol posLineCol = hashPosLineColByLanguage.get(csLg);
CFieldElement eField = new CFieldElement("", 0);
boolean bAdd = eField.setAsClosingHBox(posLineCol);
if(bAdd)
eMap.AddElement(eField);
}
}
示例12: fromSerializableHashtable
import java.util.Hashtable; //导入方法依赖的package包/类
public static AttributeValues
fromSerializableHashtable(Hashtable<Object, Object> ht)
{
AttributeValues result = new AttributeValues();
if (ht != null && !ht.isEmpty()) {
for (Map.Entry<Object, Object> e: ht.entrySet()) {
Object key = e.getKey();
Object val = e.getValue();
if (key.equals(DEFINED_KEY)) {
result.defineAll(((Integer)val).intValue());
} else {
try {
EAttribute ea =
EAttribute.forAttribute((Attribute)key);
if (ea != null) {
result.set(ea, val);
}
}
catch (ClassCastException ex) {
}
}
}
}
return result;
}
示例13: getSHA1
import java.util.Hashtable; //导入方法依赖的package包/类
/**
* 用SHA1算法生成URL参数安全签名
*
* @param params
* 参数表key,value
* @return 安全签名
* @throws AesException
*/
public static String getSHA1(Hashtable<String, Object> params) throws AesException {
try {
int size = params.size();
String[] array = new String[size];
int pos = 0;
for (Entry<String, Object> param : params.entrySet()) {
array[pos] = String.format("%s=%s", param.getKey(), param.getValue());
pos++;
}
StringBuffer sb = new StringBuffer(2048);
// 字符串排序
Arrays.sort(array);
for (int i = 0; i < array.length; i++) {
if (i != 0) {
sb.append("&");
}
sb.append(array[i]);
}
String str = sb.toString();
// SHA1签名生成
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(str.getBytes());
byte[] digest = md.digest();
StringBuffer hexstr = new StringBuffer(64);
String shaHex = "";
for (int i = 0; i < digest.length; i++) {
shaHex = Integer.toHexString(digest[i] & 0xFF);
if (shaHex.length() < 2) {
hexstr.append(0);
}
hexstr.append(shaHex);
}
return hexstr.toString();
} catch (Exception e) {
e.printStackTrace();
throw new AesException(AesException.ComputeSignatureError);
}
}
示例14: execute
import java.util.Hashtable; //导入方法依赖的package包/类
@Override
public Boolean execute(OnlineSectioningServer server, OnlineSectioningHelper helper) {
helper.beginTransaction();
try {
helper.info("Checking for expired reservations...");
Hashtable<XOffering, List<XReservation>> reservations2expire = new Hashtable<XOffering, List<XReservation>>();
for (org.unitime.timetable.model.Reservation expiredReservation: (List<org.unitime.timetable.model.Reservation>)helper.getHibSession().createQuery(
"select r from Reservation r where " +
"r.instructionalOffering.session.uniqueId = :sessionId and " +
"r.expirationDate is not null and r.expirationDate < current_timestamp()")
.setLong("sessionId", server.getAcademicSession().getUniqueId()).list()) {
XOffering offering = server.getOffering(expiredReservation.getInstructionalOffering().getUniqueId());
if (offering == null) continue;
XReservation reservation = null;
for (XReservation r: offering.getReservations())
if (r.getReservationId().equals(expiredReservation.getUniqueId())) { reservation = r; break; }
if (reservation == null || reservation.isExpired()) continue; // already expired
List<XReservation> reservations = reservations2expire.get(offering);
if (reservations == null) {
reservations = new ArrayList<XReservation>();
reservations2expire.put(offering, reservations);
}
reservations.add(reservation);
}
helper.commitTransaction();
for (Map.Entry<XOffering, List<XReservation>> entry: reservations2expire.entrySet()) {
expireReservation(entry.getKey(), entry.getValue(), server, helper);
}
} catch (Exception e) {
helper.rollbackTransaction();
if (e instanceof SectioningException)
throw (SectioningException)e;
throw new SectioningException(MSG.exceptionUnknown(e.getMessage()), e);
}
return true;
}
示例15: getLeadingClassificationName
import java.util.Hashtable; //导入方法依赖的package包/类
public String getLeadingClassificationName() {
Hashtable<String, int[]> cnt = getClassifications();
String best = null;
int bestValue = 0;
for (Map.Entry<String, int[]> e: cnt.entrySet()) {
if (e.getValue()[0] > bestValue) {
bestValue = e.getValue()[0];
best = e.getKey();
}
}
return best;
}