Example usage for java.util SortedMap size

List of usage examples for java.util SortedMap size

Introduction

In this page you can find the example usage for java.util SortedMap size.

Prototype

int size();

Source Link

Document

Returns the number of key-value mappings in this map.

Usage

From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgClient.CFGenKbXMsgClientAuditActionTable.java

public CFGenKbAuditActionBuff[] readAllDerived(CFGenKbAuthorization Authorization) {
    final String S_ProcName = "readAllDerived";
    String rqst = CFGenKbXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t"
            + CFGenKbXMsgAuditActionMessageFormatter.formatAuditActionRqstReadAll("\n\t\t\t") + "\n"
            + CFGenKbXMsgSchemaMessageFormatter.formatRqstXmlPostamble();
    String rspn = schema.sendReceive(Authorization, rqst);
    if ((rspn == null) || (rspn.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn");
    }/* ww w  . j  ava 2s .  co m*/
    CFGenKbXMsgRspnHandler responseHandler = schema.getResponseHandler();
    responseHandler.parseStringContents(rspn);
    CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised();
    if (exceptionRaised != null) {
        throw exceptionRaised;
    }
    Object sortedMapObj = responseHandler.getSortedMapOfObjects();
    if (sortedMapObj == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                "responseHandler.getSortedMapOfObjects");
    }
    SortedMap<CFGenKbAuditActionPKey, ICFGenKbAuditActionObj> sortedMap = (SortedMap<CFGenKbAuditActionPKey, ICFGenKbAuditActionObj>) sortedMapObj;
    int sz = sortedMap.size();
    CFGenKbAuditActionBuff arr[] = new CFGenKbAuditActionBuff[sz];
    Iterator<ICFGenKbAuditActionObj> iter = sortedMap.values().iterator();
    ICFGenKbAuditActionObj cur;
    for (int idx = 0; idx < sz; idx++) {
        cur = (ICFGenKbAuditActionObj) iter.next();
        arr[idx] = cur.getAuditActionBuff();
    }
    return (arr);
}

From source file:net.sourceforge.msscodefactory.cfcore.v1_11.GenKbRam.GenKbRamSecGroupTable.java

public GenKbSecGroupBuff[] readDerivedByClusterIdx(GenKbAuthorization Authorization, long ClusterId) {
    final String S_ProcName = "GenKbRamSecGroup.readDerivedByClusterIdx() ";
    GenKbSecGroupByClusterIdxKey key = schema.getFactorySecGroup().newClusterIdxKey();
    key.setRequiredClusterId(ClusterId);

    GenKbSecGroupBuff[] recArray;/*from www.  ja  v a 2  s  . c o  m*/
    if (dictByClusterIdx.containsKey(key)) {
        SortedMap<GenKbSecGroupPKey, GenKbSecGroupBuff> subdictClusterIdx = dictByClusterIdx.get(key);
        recArray = new GenKbSecGroupBuff[subdictClusterIdx.size()];
        Iterator<GenKbSecGroupBuff> iter = subdictClusterIdx.values().iterator();
        int idx = 0;
        while (iter.hasNext()) {
            recArray[idx++] = iter.next();
        }
    } else {
        recArray = new GenKbSecGroupBuff[0];
    }
    return (recArray);
}

From source file:fr.landel.utils.commons.MapUtils2Test.java

/**
 * Test method for/*from  w  w  w.  j  ava2 s  .c o  m*/
 * {@link MapUtils2#newMap(java.util.function.Supplier, java.lang.Class, java.lang.Class, java.lang.Object[])}.
 */
@Test
public void testNewMapSupplierClass() {
    SortedMap<String, Long> map = MapUtils2.newMap(TreeMap::new, String.class, Long.class, "key1", 1L, "key2",
            2L);

    assertTrue(map instanceof TreeMap);
    assertEquals(2, map.size());

    Map<String, Long> expectedMap = new HashMap<>();
    expectedMap.put("key1", 1L);
    expectedMap.put("key2", 2L);

    for (Entry<String, Long> entry : expectedMap.entrySet()) {
        assertTrue(map.containsKey(entry.getKey()));
        assertEquals(entry.getValue(), map.get(entry.getKey()));
    }

    map = MapUtils2.newMap(TreeMap::new, String.class, Long.class);

    assertTrue(map instanceof TreeMap);
    assertTrue(map.isEmpty());

    map = MapUtils2.newMap(() -> new TreeMap<>(Comparators.STRING.desc()), String.class, Long.class, "key1", 1L,
            "key2", 2L, null, 3L, "key4", null, 2d, 5L, "key6", true);

    assertTrue(map instanceof TreeMap);
    assertEquals(4, map.size());

    "key2".equals(map.firstKey());

    map = MapUtils2.newMap(TreeMap::new, String.class, Long.class, new Object[0]);

    assertTrue(map instanceof TreeMap);
    assertTrue(map.isEmpty());

    assertException(() -> {
        MapUtils2.newMap(TreeMap::new, null, Long.class, "", "");
    }, NullPointerException.class);

    assertException(() -> {
        MapUtils2.newMap(TreeMap::new, String.class, null, "", "");
    }, NullPointerException.class);

    assertException(() -> {
        MapUtils2.newMap(null, String.class, Long.class, "", "");
    }, NullPointerException.class);

    assertException(() -> {
        MapUtils2.newMap(TreeMap::new, String.class, Long.class, (Object[]) null);
    }, IllegalArgumentException.class,
            "objects cannot be null or empty and has to contain an odd number of elements");

    assertException(() -> {
        MapUtils2.newMap(TreeMap::new, String.class, Long.class, "key");
    }, IllegalArgumentException.class,
            "objects cannot be null or empty and has to contain an odd number of elements");
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgClient.CFAccXMsgClientTagTable.java

public CFAccTagBuff[] readAllDerived(CFAccAuthorization Authorization) {
    final String S_ProcName = "readAllDerived";
    String rqst = CFAccXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t"
            + CFAccXMsgTagMessageFormatter.formatTagRqstReadAll("\n\t\t\t") + "\n"
            + CFAccXMsgSchemaMessageFormatter.formatRqstXmlPostamble();
    String rspn = schema.sendReceive(Authorization, rqst);
    if ((rspn == null) || (rspn.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn");
    }/*from   w  w w .  j  a  va2 s .  c o  m*/
    CFAccXMsgRspnHandler responseHandler = schema.getResponseHandler();
    responseHandler.parseStringContents(rspn);
    CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised();
    if (exceptionRaised != null) {
        throw exceptionRaised;
    }
    Object sortedMapObj = responseHandler.getSortedMapOfObjects();
    if (sortedMapObj == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                "responseHandler.getSortedMapOfObjects");
    }
    SortedMap<CFAccTagPKey, ICFAccTagObj> sortedMap = (SortedMap<CFAccTagPKey, ICFAccTagObj>) sortedMapObj;
    int sz = sortedMap.size();
    CFAccTagBuff arr[] = new CFAccTagBuff[sz];
    Iterator<ICFAccTagObj> iter = sortedMap.values().iterator();
    ICFAccTagObj cur;
    for (int idx = 0; idx < sz; idx++) {
        cur = (ICFAccTagObj) iter.next();
        arr[idx] = cur.getTagBuff();
    }
    return (arr);
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgClient.CFAccXMsgClientTagTable.java

public CFAccTagBuff[] readDerivedByTenantIdx(CFAccAuthorization Authorization, long argTenantId) {
    final String S_ProcName = "readDerivedByTenantIdx";
    String rqst = CFAccXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t"
            + CFAccXMsgTagMessageFormatter.formatTagRqstReadByTenantIdx("\n\t\t\t", argTenantId) + "\n"
            + CFAccXMsgSchemaMessageFormatter.formatRqstXmlPostamble();
    String rspn = schema.sendReceive(Authorization, rqst);
    if ((rspn == null) || (rspn.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn");
    }/*ww w  .java 2 s.  c  om*/
    CFAccXMsgRspnHandler responseHandler = schema.getResponseHandler();
    responseHandler.parseStringContents(rspn);
    CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised();
    if (exceptionRaised != null) {
        throw exceptionRaised;
    }
    Object sortedMapObj = responseHandler.getSortedMapOfObjects();
    if (sortedMapObj == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                "responseHandler.getSortedMapOfObjects");
    }
    SortedMap<CFAccTagPKey, ICFAccTagObj> sortedMap = (SortedMap<CFAccTagPKey, ICFAccTagObj>) sortedMapObj;
    int sz = sortedMap.size();
    CFAccTagBuff arr[] = new CFAccTagBuff[sz];
    Iterator<ICFAccTagObj> iter = sortedMap.values().iterator();
    ICFAccTagObj cur;
    for (int idx = 0; idx < sz; idx++) {
        cur = (ICFAccTagObj) iter.next();
        arr[idx] = cur.getTagBuff();
    }
    return (arr);
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgClient.CFAccXMsgClientTldTable.java

public CFAccTldBuff[] readAllDerived(CFAccAuthorization Authorization) {
    final String S_ProcName = "readAllDerived";
    String rqst = CFAccXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t"
            + CFAccXMsgTldMessageFormatter.formatTldRqstReadAll("\n\t\t\t") + "\n"
            + CFAccXMsgSchemaMessageFormatter.formatRqstXmlPostamble();
    String rspn = schema.sendReceive(Authorization, rqst);
    if ((rspn == null) || (rspn.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn");
    }/*from   w  w w. j av a  2  s  .co m*/
    CFAccXMsgRspnHandler responseHandler = schema.getResponseHandler();
    responseHandler.parseStringContents(rspn);
    CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised();
    if (exceptionRaised != null) {
        throw exceptionRaised;
    }
    Object sortedMapObj = responseHandler.getSortedMapOfObjects();
    if (sortedMapObj == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                "responseHandler.getSortedMapOfObjects");
    }
    SortedMap<CFAccTldPKey, ICFAccTldObj> sortedMap = (SortedMap<CFAccTldPKey, ICFAccTldObj>) sortedMapObj;
    int sz = sortedMap.size();
    CFAccTldBuff arr[] = new CFAccTldBuff[sz];
    Iterator<ICFAccTldObj> iter = sortedMap.values().iterator();
    ICFAccTldObj cur;
    for (int idx = 0; idx < sz; idx++) {
        cur = (ICFAccTldObj) iter.next();
        arr[idx] = cur.getTldBuff();
    }
    return (arr);
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgClient.CFAccXMsgClientTldTable.java

public CFAccTldBuff[] readDerivedByTenantIdx(CFAccAuthorization Authorization, long argTenantId) {
    final String S_ProcName = "readDerivedByTenantIdx";
    String rqst = CFAccXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t"
            + CFAccXMsgTldMessageFormatter.formatTldRqstReadByTenantIdx("\n\t\t\t", argTenantId) + "\n"
            + CFAccXMsgSchemaMessageFormatter.formatRqstXmlPostamble();
    String rspn = schema.sendReceive(Authorization, rqst);
    if ((rspn == null) || (rspn.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn");
    }// w w w .  j ava2 s.c  om
    CFAccXMsgRspnHandler responseHandler = schema.getResponseHandler();
    responseHandler.parseStringContents(rspn);
    CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised();
    if (exceptionRaised != null) {
        throw exceptionRaised;
    }
    Object sortedMapObj = responseHandler.getSortedMapOfObjects();
    if (sortedMapObj == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                "responseHandler.getSortedMapOfObjects");
    }
    SortedMap<CFAccTldPKey, ICFAccTldObj> sortedMap = (SortedMap<CFAccTldPKey, ICFAccTldObj>) sortedMapObj;
    int sz = sortedMap.size();
    CFAccTldBuff arr[] = new CFAccTldBuff[sz];
    Iterator<ICFAccTldObj> iter = sortedMap.values().iterator();
    ICFAccTldObj cur;
    for (int idx = 0; idx < sz; idx++) {
        cur = (ICFAccTldObj) iter.next();
        arr[idx] = cur.getTldBuff();
    }
    return (arr);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstXMsgClient.CFAstXMsgClientTldTable.java

public CFAstTldBuff[] readAllDerived(CFAstAuthorization Authorization) {
    final String S_ProcName = "readAllDerived";
    String rqst = CFAstXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t"
            + CFAstXMsgTldMessageFormatter.formatTldRqstReadAll("\n\t\t\t") + "\n"
            + CFAstXMsgSchemaMessageFormatter.formatRqstXmlPostamble();
    String rspn = schema.sendReceive(Authorization, rqst);
    if ((rspn == null) || (rspn.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn");
    }//from w ww. ja va 2 s .  c  om
    CFAstXMsgRspnHandler responseHandler = schema.getResponseHandler();
    responseHandler.parseStringContents(rspn);
    CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised();
    if (exceptionRaised != null) {
        throw exceptionRaised;
    }
    Object sortedMapObj = responseHandler.getSortedMapOfObjects();
    if (sortedMapObj == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                "responseHandler.getSortedMapOfObjects");
    }
    SortedMap<CFAstTldPKey, ICFAstTldObj> sortedMap = (SortedMap<CFAstTldPKey, ICFAstTldObj>) sortedMapObj;
    int sz = sortedMap.size();
    CFAstTldBuff arr[] = new CFAstTldBuff[sz];
    Iterator<ICFAstTldObj> iter = sortedMap.values().iterator();
    ICFAstTldObj cur;
    for (int idx = 0; idx < sz; idx++) {
        cur = (ICFAstTldObj) iter.next();
        arr[idx] = cur.getTldBuff();
    }
    return (arr);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstXMsgClient.CFAstXMsgClientTldTable.java

public CFAstTldBuff[] readDerivedByTenantIdx(CFAstAuthorization Authorization, long argTenantId) {
    final String S_ProcName = "readDerivedByTenantIdx";
    String rqst = CFAstXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t"
            + CFAstXMsgTldMessageFormatter.formatTldRqstReadByTenantIdx("\n\t\t\t", argTenantId) + "\n"
            + CFAstXMsgSchemaMessageFormatter.formatRqstXmlPostamble();
    String rspn = schema.sendReceive(Authorization, rqst);
    if ((rspn == null) || (rspn.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn");
    }/*from  www. j a  va  2  s . c  o  m*/
    CFAstXMsgRspnHandler responseHandler = schema.getResponseHandler();
    responseHandler.parseStringContents(rspn);
    CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised();
    if (exceptionRaised != null) {
        throw exceptionRaised;
    }
    Object sortedMapObj = responseHandler.getSortedMapOfObjects();
    if (sortedMapObj == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                "responseHandler.getSortedMapOfObjects");
    }
    SortedMap<CFAstTldPKey, ICFAstTldObj> sortedMap = (SortedMap<CFAstTldPKey, ICFAstTldObj>) sortedMapObj;
    int sz = sortedMap.size();
    CFAstTldBuff arr[] = new CFAstTldBuff[sz];
    Iterator<ICFAstTldObj> iter = sortedMap.values().iterator();
    ICFAstTldObj cur;
    for (int idx = 0; idx < sz; idx++) {
        cur = (ICFAstTldObj) iter.next();
        arr[idx] = cur.getTldBuff();
    }
    return (arr);
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmXMsgClient.CFCrmXMsgClientSecGroupTable.java

public CFCrmSecGroupBuff[] readAllDerived(CFCrmAuthorization Authorization) {
    final String S_ProcName = "readAllDerived";
    String rqst = CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t"
            + CFCrmXMsgSecGroupMessageFormatter.formatSecGroupRqstReadAll("\n\t\t\t") + "\n"
            + CFCrmXMsgSchemaMessageFormatter.formatRqstXmlPostamble();
    String rspn = schema.sendReceive(Authorization, rqst);
    if ((rspn == null) || (rspn.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn");
    }//from w ww.  ja va 2  s.  co  m
    CFCrmXMsgRspnHandler responseHandler = schema.getResponseHandler();
    responseHandler.parseStringContents(rspn);
    CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised();
    if (exceptionRaised != null) {
        throw exceptionRaised;
    }
    Object sortedMapObj = responseHandler.getSortedMapOfObjects();
    if (sortedMapObj == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                "responseHandler.getSortedMapOfObjects");
    }
    SortedMap<CFCrmSecGroupPKey, ICFCrmSecGroupObj> sortedMap = (SortedMap<CFCrmSecGroupPKey, ICFCrmSecGroupObj>) sortedMapObj;
    int sz = sortedMap.size();
    CFCrmSecGroupBuff arr[] = new CFCrmSecGroupBuff[sz];
    Iterator<ICFCrmSecGroupObj> iter = sortedMap.values().iterator();
    ICFCrmSecGroupObj cur;
    for (int idx = 0; idx < sz; idx++) {
        cur = (ICFCrmSecGroupObj) iter.next();
        arr[idx] = cur.getSecGroupBuff();
    }
    return (arr);
}