当前位置: 首页>>代码示例>>Java>>正文


Java Hashtable.size方法代码示例

本文整理汇总了Java中java.util.Hashtable.size方法的典型用法代码示例。如果您正苦于以下问题:Java Hashtable.size方法的具体用法?Java Hashtable.size怎么用?Java Hashtable.size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Hashtable的用法示例。


在下文中一共展示了Hashtable.size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doTest

import java.util.Hashtable; //导入方法依赖的package包/类
public void doTest() throws Exception {
    // Initialize DataFlavors and arrays used for test data
    initMappings();

    boolean passed = true;
    flavorMap = (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();

    // Get all the native strings and preferred DataFlavor mappings
    hash = new Hashtable(flavorMap.getFlavorsForNatives(null));
    hashSize = hash.size();

    // GetNativesForFlavor using unknown DataFlavor (verify 2-way mapping)
    //
    // If a new DataFlavor is specified, the method should establish a mapping
    // in both directions between specified DataFlavor and an encoded
    // version of its MIME type as its native.
    System.out.println("GetNativesForFlavor using new DataFlavor");

    comp1 = new Vector(Arrays.asList(test_natives_set));
    comp2 = new Vector(flavorMap.getNativesForFlavor(test_flavor1));

    comp3 = new Vector(Arrays.asList(test_flavors_set));
    comp4 = new Vector(flavorMap.getFlavorsForNative(test_encoded));

    if ( !comp1.equals(comp2) || !comp3.equals(comp4) ) {
        throw new RuntimeException("\n*** After passing a new DataFlavor" +
            "\nwith getNativesForFlavor(DataFlavor flav)" +
            "\nthe mapping in both directions was not established.");
    }
    else
       System.out.println("GetNativesForFlavor using new DataFlavor: Test Passes");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:GetNativesForNewFlavorTest.java

示例2: proceedAgentAnswers

import java.util.Hashtable; //导入方法依赖的package包/类
@Override
public void proceedAgentAnswers(Hashtable<AID, Object> agentAnswers) {

	// --- Define new display EnvironmentModel ----------------------------
	HashMap<String, Integer> localEnvModelNew = new HashMap<String, Integer>();
	AID[] agentArray = new AID[agentAnswers.size()];
	agentArray = agentAnswers.keySet().toArray(agentArray);
	for (int i = 0; i < agentArray.length; i++) {
		Integer value = (Integer) agentAnswers.get(agentArray[i]);  
		localEnvModelNew.put(agentArray[i].getLocalName(), value);
	}
	this.golModel.setGolHash(localEnvModelNew);
	
	// --- Did we've got edits from the visual representation ? -----------
	if (this.golModelEdited!=null) {
		this.golModel = this.golModelEdited;
		this.golModelEdited = null;
	}
	this.doNextSimulationStep();
	
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:22,代码来源:SimulationManager.java

示例3: engineSize

import java.util.Hashtable; //导入方法依赖的package包/类
public int engineSize()
{
    Hashtable tab = new Hashtable();

    Enumeration e = certs.keys();
    while (e.hasMoreElements())
    {
        tab.put(e.nextElement(), "cert");
    }

    e = keys.keys();
    while (e.hasMoreElements())
    {
        String a = (String)e.nextElement();
        if (tab.get(a) == null)
        {
            tab.put(a, "key");
        }
    }

    return tab.size();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:23,代码来源:PKCS12KeyStoreSpi.java

示例4: unregisterWithKeyboardManager

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Unregisters all the previously registered
 * <code>WHEN_IN_FOCUSED_WINDOW</code> <code>KeyStroke</code> bindings.
 */
private void unregisterWithKeyboardManager() {
    @SuppressWarnings("unchecked")
    Hashtable<KeyStroke, KeyStroke> registered =
            (Hashtable<KeyStroke, KeyStroke>)getClientProperty
                            (WHEN_IN_FOCUSED_WINDOW_BINDINGS);

    if (registered != null && registered.size() > 0) {
        Enumeration<KeyStroke> keys = registered.keys();

        while (keys.hasMoreElements()) {
            KeyStroke ks = keys.nextElement();
            unregisterWithKeyboardManager(ks);
        }
    }
    putClientProperty(WHEN_IN_FOCUSED_WINDOW_BINDINGS, null);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:JComponent.java

示例5: extractConstPoolInfo

import java.util.Hashtable; //导入方法依赖的package包/类
private void extractConstPoolInfo() {
    int iMaxPoolLen = constPool.getPoolInfoCount();
    int iIndex;
    hashUTF = new Hashtable();

    for (iIndex = 0; iIndex < iMaxPoolLen; iIndex++) {
        ConstantPoolInfo thisInfo = (ConstantPoolInfo) constPool.getPoolInfo(iIndex + 1);
        if (ConstantPoolInfo.CONSTANT_Utf8 == thisInfo.iTag) {
            hashUTF.put(thisInfo.sUTFStr, new Integer(iIndex + 1));
        }
    }

    Enumeration allKeys;
    strUTF = new String[hashUTF.size()];
    allKeys = hashUTF.keys();
    for (iIndex = 0; allKeys.hasMoreElements(); iIndex++) {
        strUTF[iIndex] = (String) allKeys.nextElement();
    }
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:20,代码来源:SourceFileAttribPane.java

示例6: isIDLGeneratedFor

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Determine if IDL should be generated for a referenced type.
 * Do not generate IDL for a CORBA Object reference. It gets mapped
 * to the original IDL or to Object (if exactly org.omg.CORBA.Object)
 * Generate (boxed) IDL for an IDL Entity unless it is an IDL user
 * exception, a ValueBase, an AbstractBase (or a CORBA Object).
 * Do not generate IDL for Implementation classes..unless they inherit
 * from multiple distinct remote interfaces
 * @param t The type to check.
 * @return true or false
 */
protected boolean isIDLGeneratedFor(
                             CompoundType t ) {
    if ( t.isCORBAObject() ) return false;
    if ( t.isIDLEntity() )
        if ( t.isBoxed() ) return true;
        else if ( "org.omg.CORBA.portable.IDLEntity"
                  .equals( t.getQualifiedName() ) ) return true;
        else if ( t.isCORBAUserException() ) return true;
        else return false;
    Hashtable inhHash = new Hashtable();
    getInterfaces( t,inhHash );
    if ( t.getTypeCode() == TYPE_IMPLEMENTATION )
        if ( inhHash.size() < 2 ) return false;         //no multiple inheritance
        else return true;
    return true;                                   //generate IDL for this type
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:IDLGenerator.java

示例7: 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;
        }
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:SunFontManager.java

示例8: addPropertiesTab

import java.util.Hashtable; //导入方法依赖的package包/类
private void addPropertiesTab() {
    if (compNode instanceof ComponentNode) {
        Hashtable<String, Object> props = ((ContainerNode) compNode).getProperties();
        if (props.size() > 0) {
            JTable propTable = new JTable(new MyModel(props));
            propTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
            tbd.add(PROPERTIES_TAB, new JScrollPane(propTable));
            /*
            propTable.addMouseListener(new MouseListener() {
                public void mouseClicked(MouseEvent e) {
                    new ComponentBrowser(getOwnr(),
                            getSelectedNode()).
                            show();
                }
                public void mouseExited(MouseEvent e) {
                }
                public void mouseEntered(MouseEvent e) {
                }
                public void mousePressed(MouseEvent e) {
                }
                public void mouseReleased(MouseEvent e) {
                }
            });
             */
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:GUIBrowser.java

示例9: NonMissingStochObserverExchangeItem

import java.util.Hashtable; //导入方法依赖的package包/类
public NonMissingStochObserverExchangeItem(IPrevExchangeItem ioExchangeItem, double missingValue){
    this.ioExchangeItem = ioExchangeItem;
    Hashtable<Integer,Double> eiValues = new Hashtable<Integer,Double>();
    Hashtable<Integer,Double> eiTimes = new Hashtable<Integer,Double>();
    boolean isMissing = false;
    int iNonMissing = 0;
    double[] orgValues = ioExchangeItem.getValuesAsDoubles();
    double[] orgTimes = ioExchangeItem.getTimes();
    //TODO: determine the 'most' appropriate value of epsilon
    if (orgTimes.length != orgValues.length) {
        throw new RuntimeException("org.openda.observers.NonMissingStochObserverExchangeItem: Inconsistent #times/#values of original exchange item.");
    }
    if(orgTimes!=null){
    double epsilon = 1.E-5;
    if (orgValues!=null && orgTimes!=null) {
    	for (int iValues=0; iValues<orgValues.length; iValues++){
    		if ((Double.isNaN(orgValues[iValues]) || Math.abs(orgValues[iValues]-missingValue)<epsilon)){
    			isMissing = true;
    		} else {
    			eiValues.put(iNonMissing,orgValues[iValues]);
    			eiTimes.put(iNonMissing,orgTimes[iValues]);
    			iNonMissing++;
    		}
    	}
    }
    }
    if (isMissing){
        double[] newValues = new double[eiValues.size()];
        double[] newTimes = new double[eiValues.size()];
        for (int iNewValues=0; iNewValues<newValues.length; iNewValues++){
            newValues[iNewValues] = eiValues.get(iNewValues);
            newTimes[iNewValues] = eiTimes.get(iNewValues);
        }
        this.values = newValues;
        this.times = newTimes;
    } else {
        values = this.ioExchangeItem.getValuesAsDoubles();
        times = this.ioExchangeItem.getTimes();
    }
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:41,代码来源:NonMissingStochObserverExchangeItem.java

示例10: getKeys

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Returns the keys of the table, or <code>null</code> if there
 * are currently no bindings.
 * @param keys  array of keys
 * @return an array of bindings
 */
public Object[] getKeys(Object[] keys) {
    if (table == null) {
        return null;
    }
    if (isArray()) {
        Object[] array = (Object[])table;
        if (keys == null) {
            keys = new Object[array.length / 2];
        }
        for (int i = 0, index = 0 ;i < array.length-1 ; i+=2,
                 index++) {
            keys[index] = array[i];
        }
    } else {
        Hashtable<?,?> tmp = (Hashtable)table;
        Enumeration<?> enum_ = tmp.keys();
        int counter = tmp.size();
        if (keys == null) {
            keys = new Object[counter];
        }
        while (counter > 0) {
            keys[--counter] = enum_.nextElement();
        }
    }
    return keys;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:33,代码来源:ArrayTable.java

示例11: clone

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * sets the information needed to reconstruct the baseCtx if
 * we are serialized. This must be called _before_ the object is
 * serialized!!!
 */
@SuppressWarnings("unchecked") // clone()
private void setBaseCtxInfo() {
    Hashtable<String, Object> realEnv = null;
    Hashtable<String, Object> secureEnv = null;

    if (baseCtx != null) {
        realEnv = ((LdapCtx)baseCtx).envprops;
        this.baseCtxURL = ((LdapCtx)baseCtx).getURL();
    }

    if(realEnv != null && realEnv.size() > 0 ) {
        // remove any security credentials - otherwise the serialized form
        // would store them in the clear
        for (String key : realEnv.keySet()){
            if (key.indexOf("security") != -1 ) {

                //if we need to remove props, we must do it to a clone
                //of the environment. cloning is expensive, so we only do
                //it if we have to.
                if(secureEnv == null) {
                    secureEnv = (Hashtable<String, Object>)realEnv.clone();
                }
                secureEnv.remove(key);
            }
        }
    }

    // set baseCtxEnv depending on whether we removed props or not
    this.baseCtxEnv = (secureEnv == null ? realEnv : secureEnv);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:36,代码来源:LdapAttribute.java

示例12: SwitchDataEnumeration

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Create a new enumeration from the hashtable.  Each key in the
 * hash table will be an Integer, with the value being a label.  The
 * enumeration returns the keys in sorted order.
 */
SwitchDataEnumeration(Hashtable<Integer,Label> tab) {
    table = new Integer[tab.size()];
    int i = 0;
    for (Enumeration<Integer> e = tab.keys() ; e.hasMoreElements() ; ) {
        table[i++] = e.nextElement();
    }
    Arrays.sort(table);
    current_index = 0;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:15,代码来源:SwitchData.java

示例13: windowClosed

import java.util.Hashtable; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void windowClosed(GUIFramework framework, Element element,
                         Attribute attribute) {
    Hashtable<Element, Hashtable<Attribute, HistoryDialog>> h = (Hashtable<Element, Hashtable<Attribute, HistoryDialog>>) framework
            .get("HistoryDialogs");
    Hashtable<Attribute, HistoryDialog> h1 = h.get(element);
    h1.remove(attribute);
    if (h1.size() == 0)
        h.remove(element);
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:11,代码来源:QualifierHistoryPlugin.java

示例14: readObject

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * readObject is called to restore the state of the
 * BasicPermissionCollection from a stream.
 */
private void readObject(java.io.ObjectInputStream in)
     throws IOException, ClassNotFoundException
{
    // Don't call defaultReadObject()

    // Read in serialized fields
    ObjectInputStream.GetField gfields = in.readFields();

    // Get permissions
    // writeObject writes a Hashtable<String, Permission> for the
    // permissions key, so this cast is safe, unless the data is corrupt.
    @SuppressWarnings("unchecked")
    Hashtable<String, Permission> permissions =
            (Hashtable<String, Permission>)gfields.get("permissions", null);
    perms = new ConcurrentHashMap<>(permissions.size()*2);
    perms.putAll(permissions);

    // Get all_allowed
    all_allowed = gfields.get("all_allowed", false);

    // Get permClass
    permClass = (Class<?>) gfields.get("permClass", null);

    if (permClass == null) {
        // set permClass
        Enumeration<Permission> e = permissions.elements();
        if (e.hasMoreElements()) {
            Permission p = e.nextElement();
            permClass = p.getClass();
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:37,代码来源:BasicPermission.java

示例15: getInitialContext

import java.util.Hashtable; //导入方法依赖的package包/类
public static InitialContext getInitialContext(final JobDataMap jobDataMap) throws NamingException
{
    
    Hashtable params = new Hashtable(2);
    
    String initialContextFactory =
        jobDataMap.getString(INITIAL_CONTEXT_FACTORY);

    if (initialContextFactory != null) {
        params.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
    }
    
    String providerUrl = jobDataMap.getString(PROVIDER_URL);
    if (providerUrl != null) {
        params.put(Context.PROVIDER_URL, providerUrl);
    }

    String principal = jobDataMap.getString(PRINCIPAL);
    if ( principal != null ) {
        params.put( Context.SECURITY_PRINCIPAL, principal );
    }

    String credentials = jobDataMap.getString(CREDENTIALS);
    if ( credentials != null ) {
        params.put( Context.SECURITY_CREDENTIALS, credentials );
    }

    if (params.size() == 0) {
        return new InitialContext();
    } else {
        return new InitialContext(params);
    }
    
}
 
开发者ID:AsuraTeam,项目名称:asura,代码行数:35,代码来源:JmsHelper.java


注:本文中的java.util.Hashtable.size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。