• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ArrayHelper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.helger.commons.collection.ArrayHelper的典型用法代码示例。如果您正苦于以下问题:Java ArrayHelper类的具体用法?Java ArrayHelper怎么用?Java ArrayHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ArrayHelper类属于com.helger.commons.collection包,在下文中一共展示了ArrayHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: toArray

import com.helger.commons.collection.ArrayHelper; //导入依赖的package包/类
@Nonnull
public <ARRAYELEMENTTYPE> ARRAYELEMENTTYPE [] toArray (@Nonnull final ARRAYELEMENTTYPE [] aDest)
{
  ValueEnforcer.notNull (aDest, "Dest");

  if (!m_bHasElement)
    return aDest;
  if (m_aElement != null && !aDest.getClass ().getComponentType ().isAssignableFrom (m_aElement.getClass ()))
    throw new ArrayStoreException ("The array class " +
                                   aDest.getClass () +
                                   " cannot store the item of class " +
                                   m_aElement.getClass ());
  final ARRAYELEMENTTYPE [] ret = aDest.length < 1 ? ArrayHelper.newArraySameType (aDest, 1) : aDest;
  ret[0] = GenericReflection.uncheckedCast (m_aElement);
  if (ret.length > 1)
    ret[1] = null;
  return ret;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:19,代码来源:SingleElementList.java


示例2: _unifySinglePart

import com.helger.commons.collection.ArrayHelper; //导入依赖的package包/类
/**
 * Unify a single name part. Performs the following transformations:
 * <ul>
 * <li>Remove leading and trailing whitespaces</li>
 * <li>If the name is all upper case, down case all except the first character
 * </li>
 * </ul>
 *
 * @param sPart
 *        The string part to be unified
 * @param aSortLocale
 *        The local to use (for case changing)
 * @return The unified part
 */
@Nullable
private static String _unifySinglePart (@Nonnull final String sPart, @Nonnull final Locale aSortLocale)
{
  // empty name?
  String s = sPart.trim ();
  final int nLength = s.length ();
  if (nLength == 0)
    return null;

  // all upper case name?
  if (nLength == 1)
    return s.toUpperCase (aSortLocale);

  // uppercase first only
  s = s.substring (0, 1).toUpperCase (aSortLocale) + s.substring (1).toLowerCase (aSortLocale);

  // special cases: nobiliary particles ;-)
  if (ArrayHelper.contains (NOBILIARY_PARTICLES, s))
    s = s.toLowerCase (aSortLocale);

  return s;
}
 
开发者ID:phax,项目名称:ph-masterdata,代码行数:37,代码来源:PersonNameHelper.java


示例3: testAllBOMCharsets

import com.helger.commons.collection.ArrayHelper; //导入依赖的package包/类
@Test
public void testAllBOMCharsets ()
{
  for (final EUnicodeBOM eBOM : EUnicodeBOM.values ())
    if (eBOM.hasCharset ())
    {
      final Charset c = eBOM.getCharset ();
      final ICommonsList <String> aNames = new CommonsArrayList <> (c.name ());
      aNames.addAll (c.aliases ());
      for (final String sAlias : aNames)
      {
        final String sXML = "<?xml version=\"1.0\" encoding=\"" + sAlias + "\"?><!-- " + c.name () + " --><root />";
        if (false)
          System.out.println (sXML);
        final byte [] aBytes = sXML.getBytes (c);
        assertFalse ("Charset " + sAlias + " already contains BOM " + eBOM, eBOM.isPresent (aBytes));

        // Prefix with BOM
        final Charset aDetermined = XMLCharsetDeterminator.determineXMLCharset (ArrayHelper.getConcatenated (eBOM.getAllBytes (),
                                                                                                             aBytes));
        assertEquals (c, aDetermined);
      }
    }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:25,代码来源:XMLCharsetDeterminatorTest.java


示例4: jsonUnescape

import com.helger.commons.collection.ArrayHelper; //导入依赖的package包/类
@Nonnull
public static String jsonUnescape (@Nonnull final char [] aInput)
{
  ValueEnforcer.notNull (aInput, "Input");

  if (!ArrayHelper.contains (aInput, MASK_CHAR))
  {
    // Nothing to unescape
    return new String (aInput);
  }

  // Perform unescape
  final StringBuilder aSB = new StringBuilder (aInput.length);
  jsonUnescapeToStringBuilder (aInput, aSB);
  return aSB.toString ();
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:17,代码来源:JsonEscapeHelper.java


示例5: removeMultiple

import com.helger.commons.collection.ArrayHelper; //导入依赖的package包/类
/**
 * Optimized remove method that removes a set of characters from an input
 * string!
 *
 * @param sInputString
 *        The input string.
 * @param aRemoveChars
 *        The characters to remove. May not be <code>null</code>.
 * @return The version of the string without the passed characters or an empty
 *         String if the input string was <code>null</code>.
 */
@Nonnull
public static String removeMultiple (@Nullable final String sInputString, @Nonnull final char [] aRemoveChars)
{
  ValueEnforcer.notNull (aRemoveChars, "RemoveChars");

  // Any input text?
  if (hasNoText (sInputString))
    return "";

  // Anything to remove?
  if (aRemoveChars.length == 0)
    return sInputString;

  final StringBuilder aSB = new StringBuilder (sInputString.length ());
  iterateChars (sInputString, cInput -> {
    if (!ArrayHelper.contains (aRemoveChars, cInput))
      aSB.append (cInput);
  });
  return aSB.toString ();
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:32,代码来源:StringHelper.java


示例6: getFormattedText

import com.helger.commons.collection.ArrayHelper; //导入依赖的package包/类
@Nullable
public static String getFormattedText (@Nonnull final Locale aDisplayLocale,
                                       @Nullable final String sText,
                                       @Nullable final Object... aArgs)
{
  ValueEnforcer.notNull (aDisplayLocale, "DisplayLocale");

  if (sText == null)
  {
    // Avoid NPE in MessageFormat
    return null;
  }

  if (ArrayHelper.isEmpty (aArgs))
  {
    // Return text unchanged
    return sText;
  }

  final MessageFormat aMF = new MessageFormat (sText, aDisplayLocale);
  return aMF.format (aArgs);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:23,代码来源:TextHelper.java


示例7: testReadWithBOM

import com.helger.commons.collection.ArrayHelper; //导入依赖的package包/类
@Test
public void testReadWithBOM ()
{
  final String sCSSBase = "/* comment */.class{color:red}.class{color:blue}";
  for (final EUnicodeBOM eBOM : EUnicodeBOM.values ())
  {
    final Charset aDeterminedCharset = eBOM.getCharset ();
    if (aDeterminedCharset != null)
    {
      final CascadingStyleSheet aCSS = CSSReader.readFromStream (new ByteArrayInputStreamProvider (ArrayHelper.getConcatenated (eBOM.getAllBytes (),
                                                                                                                                sCSSBase.getBytes (aDeterminedCharset))),
                                                                 aDeterminedCharset,
                                                                 ECSSVersion.CSS30,
                                                                 new DoNothingCSSParseErrorHandler ());
      assertNotNull ("Failed to read with BOM " + eBOM, aCSS);
      assertEquals (".class{color:red}.class{color:blue}",
                    new CSSWriter (ECSSVersion.CSS30, true).getCSSAsString (aCSS));
    }
  }
}
 
开发者ID:phax,项目名称:ph-css,代码行数:21,代码来源:CSSReader30SpecialFuncTest.java


示例8: testList

import com.helger.commons.collection.ArrayHelper; //导入依赖的package包/类
@Test
public void testList ()
{
  final ICommonsList <String> aCont = new CommonsArrayList <> ("a", "b", "c");
  assertTrue (EqualsHelper.equalsCollection (aCont, aCont));
  assertTrue (EqualsHelper.equalsCollection (aCont, CollectionHelper.makeUnmodifiable (aCont)));
  assertTrue (EqualsHelper.equalsCollection (aCont, Collections.synchronizedList (aCont)));
  assertTrue (EqualsHelper.equalsCollection (aCont, new CommonsArrayList <> (aCont)));
  assertTrue (EqualsHelper.equalsCollection (aCont, new CommonsLinkedList <> (aCont)));
  assertTrue (EqualsHelper.equalsCollection (aCont, new CommonsVector <> (aCont)));
  assertTrue (EqualsHelper.equalsCollection (aCont, new NonBlockingStack <> (aCont)));
  assertTrue (EqualsHelper.equalsCollection (new CommonsArrayList <String> (), new CommonsLinkedList <String> ()));
  assertTrue (EqualsHelper.equalsCollection (new NonBlockingStack <String> (), new CommonsVector <String> ()));
  assertTrue (EqualsHelper.equalsCollection (new NonBlockingStack <String> (), new Stack <String> ()));

  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsLinkedList <String> ()));
  assertFalse (EqualsHelper.equalsCollection (new CommonsLinkedList <String> (), aCont));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsArrayList <String> ()));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsArrayList <> ("a", "b")));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsArrayList <> ("A", "b", "c")));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsArrayList <> ("a", "B", "c")));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsArrayList <> ("a", "b", "C")));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsArrayList <> ("a", "b", "c", "d")));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsHashSet <> ("a", "b", "c")));
  assertFalse (EqualsHelper.equalsCollection (aCont, ArrayHelper.newArray ("a", "b", "c")));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:27,代码来源:EqualsHelperTest.java


示例9: testSet

import com.helger.commons.collection.ArrayHelper; //导入依赖的package包/类
@Test
public void testSet ()
{
  final ICommonsSet <String> aCont = new CommonsHashSet <> ("a", "b", "c");
  assertTrue (EqualsHelper.equalsCollection (aCont, aCont));
  assertTrue (EqualsHelper.equalsCollection (aCont, CollectionHelper.makeUnmodifiable (aCont)));
  assertTrue (EqualsHelper.equalsCollection (aCont, Collections.synchronizedSet (aCont)));
  assertTrue (EqualsHelper.equalsCollection (aCont, new CommonsHashSet <> (aCont)));
  assertTrue (EqualsHelper.equalsCollection (aCont, new CommonsLinkedHashSet <> (aCont)));
  assertTrue (EqualsHelper.equalsCollection (aCont, new CommonsTreeSet <> (aCont)));
  assertTrue (EqualsHelper.equalsCollection (new CommonsHashSet <String> (), new CommonsLinkedHashSet <String> ()));
  assertTrue (EqualsHelper.equalsCollection (new CommonsTreeSet <String> (), new CommonsHashSet <String> ()));

  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsHashSet <String> ()));
  assertFalse (EqualsHelper.equalsCollection (new CommonsHashSet <String> (), aCont));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsTreeSet <String> ()));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsHashSet <> ("a", "b")));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsHashSet <> ("A", "b", "c")));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsHashSet <> ("a", "B", "c")));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsHashSet <> ("a", "b", "C")));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsHashSet <> ("a", "b", "c", "d")));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsArrayList <> ("a", "b", "c")));
  assertFalse (EqualsHelper.equalsCollection (aCont, ArrayHelper.newArray ("a", "b", "c")));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:25,代码来源:EqualsHelperTest.java


示例10: testMap

import com.helger.commons.collection.ArrayHelper; //导入依赖的package包/类
@Test
public void testMap ()
{
  final StringMap aMap = new StringMap ("a", "b").add ("c", "d");
  assertTrue (EqualsHelper.equalsCollection (aMap, aMap));
  assertTrue (EqualsHelper.equalsCollection (aMap, CollectionHelper.makeUnmodifiable (aMap)));
  assertTrue (EqualsHelper.equalsCollection (aMap, Collections.synchronizedMap (aMap)));
  assertTrue (EqualsHelper.equalsCollection (aMap, new StringMap ("a", "b").add ("c", "d")));
  assertTrue (EqualsHelper.equalsCollection (new CommonsHashMap <Integer, Integer> (),
                                             new CommonsHashMap <Double, Float> ()));

  assertFalse (EqualsHelper.equalsCollection (aMap, new CommonsHashMap <Integer, Integer> ()));
  assertFalse (EqualsHelper.equalsCollection (new CommonsHashMap <Integer, Integer> (), aMap));
  assertFalse (EqualsHelper.equalsCollection (aMap, new StringMap ("a", "b")));
  assertFalse (EqualsHelper.equalsCollection (aMap, new StringMap ("A", "b").add ("c", "d")));
  assertFalse (EqualsHelper.equalsCollection (aMap, new StringMap ("a", "B").add ("c", "d")));
  assertFalse (EqualsHelper.equalsCollection (aMap, new StringMap ("a", "b").add ("C", "d")));
  assertFalse (EqualsHelper.equalsCollection (aMap, new StringMap ("a", "b").add ("c", "D")));
  assertFalse (EqualsHelper.equalsCollection (aMap, new StringMap ("a", "b").add ("c", "d").add ("e", "f")));
  assertFalse (EqualsHelper.equalsCollection (aMap, new CommonsArrayList <> ("a", "b", "c")));
  assertFalse (EqualsHelper.equalsCollection (aMap, new CommonsHashSet <> ("a", "b", "c")));
  assertFalse (EqualsHelper.equalsCollection (aMap, ArrayHelper.newArray ("a", "b", "c")));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:24,代码来源:EqualsHelperTest.java


示例11: testArray

import com.helger.commons.collection.ArrayHelper; //导入依赖的package包/类
@Test
public void testArray ()
{
  final String [] aArray = ArrayHelper.newArray ("a", "b", "c");
  assertTrue (EqualsHelper.equalsCollection (aArray, aArray));
  assertTrue (EqualsHelper.equalsCollection (aArray, ArrayHelper.newArray ("a", "b", "c")));
  assertTrue (EqualsHelper.equalsCollection (new String [0], new String [] {}));

  assertFalse (EqualsHelper.equalsCollection (aArray, new String [0]));
  assertFalse (EqualsHelper.equalsCollection (new String [0], aArray));
  assertFalse (EqualsHelper.equalsCollection (aArray, ArrayHelper.newArray ("a", "b")));
  assertFalse (EqualsHelper.equalsCollection (aArray, ArrayHelper.newArray ("A", "b", "c")));
  assertFalse (EqualsHelper.equalsCollection (aArray, ArrayHelper.newArray ("a", "B", "c")));
  assertFalse (EqualsHelper.equalsCollection (aArray, ArrayHelper.newArray ("a", "b", "C")));
  assertFalse (EqualsHelper.equalsCollection (aArray, ArrayHelper.newArray ("a", "b", "c", "d")));
  assertFalse (EqualsHelper.equalsCollection (aArray, new CommonsArrayList <> ("a", "b", "c")));
  assertFalse (EqualsHelper.equalsCollection (aArray, new CommonsHashSet <> ("a", "b", "c")));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:19,代码来源:EqualsHelperTest.java


示例12: testIterable

import com.helger.commons.collection.ArrayHelper; //导入依赖的package包/类
@Test
public void testIterable ()
{
  final Iterable <String> aCont = new MockIterable ("a", "b", "c");
  assertTrue (EqualsHelper.equalsCollection (aCont, aCont));
  assertTrue (EqualsHelper.equalsCollection (aCont, new MockIterable ("a", "b", "c")));
  assertTrue (EqualsHelper.equalsCollection (new MockIterable (), new MockIterable ()));

  assertFalse (EqualsHelper.equalsCollection (aCont, new MockIterable ()));
  assertFalse (EqualsHelper.equalsCollection (new MockIterable (), aCont));
  assertFalse (EqualsHelper.equalsCollection (aCont, new MockIterable ("a", "b")));
  assertFalse (EqualsHelper.equalsCollection (aCont, new MockIterable ("A", "b", "c")));
  assertFalse (EqualsHelper.equalsCollection (aCont, new MockIterable ("a", "B", "c")));
  assertFalse (EqualsHelper.equalsCollection (aCont, new MockIterable ("a", "b", "C")));
  assertFalse (EqualsHelper.equalsCollection (aCont, new MockIterable ("a", "b", "c", "d")));
  assertFalse (EqualsHelper.equalsCollection (aCont, new CommonsHashSet <> ("a", "b", "c")));
  assertFalse (EqualsHelper.equalsCollection (aCont, ArrayHelper.newArray ("a", "b", "c")));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:19,代码来源:EqualsHelperTest.java


示例13: testEqualsAsCollection

import com.helger.commons.collection.ArrayHelper; //导入依赖的package包/类
@Test
public void testEqualsAsCollection ()
{
  assertTrue (EqualsHelper.equalsAsList (null, null));
  assertTrue (EqualsHelper.equalsAsList (new CommonsArrayList <> ("a", "b"), ArrayHelper.newArray ("a", "b")));
  assertTrue (EqualsHelper.equalsAsList (new CommonsArrayList <> ("a", "b"),
                                         new CommonsArrayList <> ("a", "b").iterator ()));
  assertTrue (EqualsHelper.equalsAsList (new CommonsArrayList <> ("a", "b"),
                                         IteratorHelper.getEnumeration ("a", "b")));
  assertTrue (EqualsHelper.equalsAsList (new CommonsArrayList <> ("a", "b"),
                                         CollectionHelper.newOrderedSet ("a", "b")));
  assertTrue (EqualsHelper.equalsAsList (new CommonsArrayList <> ("a", "b"), new MockIterable ("a", "b")));

  assertFalse (EqualsHelper.equalsAsList (null, "abc"));
  assertFalse (EqualsHelper.equalsAsList ("abc", null));
  assertFalse (EqualsHelper.equalsAsList (new CommonsArrayList <> ("a", "b"), ArrayHelper.newArray ("a", "B")));
  assertFalse (EqualsHelper.equalsAsList (new CommonsArrayList <> (null, "b"),
                                          ArrayHelper.newArray ("a", (String) null)));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:20,代码来源:EqualsHelperTest.java


示例14: testEquals

import com.helger.commons.collection.ArrayHelper; //导入依赖的package包/类
@Test
@SuppressFBWarnings ("EC_BAD_ARRAY_COMPARE")
public void testEquals () throws ParserConfigurationException
{
  final DocumentBuilderFactory aDocumentBuilderFactory = DocumentBuilderFactory.newInstance ();
  final DocumentBuilder aDB = aDocumentBuilderFactory.newDocumentBuilder ();

  final Document d1 = aDB.newDocument ();
  final Node aRoot1 = d1.appendChild (d1.createElementNS ("urn:my:helger:test-namespace", "root"));
  ((Element) aRoot1.appendChild (d1.createElement ("child"))).setAttribute ("any", "works");

  final Document d2 = aDB.newDocument ();
  final Node aRoot2 = d2.appendChild (d2.createElementNS ("urn:my:helger:test-namespace", "root"));
  ((Element) aRoot2.appendChild (d2.createElement ("child"))).setAttribute ("any", "works");

  // Regular
  CommonsAssert.assertEquals (d1, d2);

  // 1 level array
  CommonsAssert.assertEquals (ArrayHelper.newArray (d1), ArrayHelper.newArray (d2));

  // 2 level array
  CommonsAssert.assertEquals (ArrayHelper.newArray (ArrayHelper.newArray (d1)),
                              ArrayHelper.newArray (ArrayHelper.newArray (d2)));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:26,代码来源:EqualsImplementationRegistryTest.java


示例15: testListPrinterTrays

import com.helger.commons.collection.ArrayHelper; //导入依赖的package包/类
@Test
public void testListPrinterTrays ()
{
  final PrintService [] aAllServices = PrintServiceLookup.lookupPrintServices (null, null);
  for (final PrintService aService : aAllServices)
  {
    s_aLogger.info (aService.toString ());
    final Object aAttrs = aService.getSupportedAttributeValues (Media.class,
                                                                DocFlavor.SERVICE_FORMATTED.PAGEABLE,
                                                                null);
    if (ArrayHelper.isArray (aAttrs))
    {
      for (final Media aElement : (Media []) aAttrs)
        if (aElement instanceof MediaTray)
          s_aLogger.info ("  " + aElement);
    }
  }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:19,代码来源:JavaPrinterTrayFinderFuncTest.java


示例16: testStdMethods

import com.helger.commons.collection.ArrayHelper; //导入依赖的package包/类
@Test
public void testStdMethods ()
{
  final ArrayIterator <String> ae = new ArrayIterator <> (ArrayHelper.newArray ("Hallo",
                                                                                "Welt",
                                                                                "from",
                                                                                "Copenhagen"));
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (ae,
                                                                     new ArrayIterator <> (ArrayHelper.newArray ("Hallo",
                                                                                                                 "Welt",
                                                                                                                 "from",
                                                                                                                 "Copenhagen")));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (ae,
                                                                         new ArrayIterator <> (ArrayHelper.newArray ("Hallo",
                                                                                                                     "Welt",
                                                                                                                     "from")));
  ae.next ();
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (ae,
                                                                         new ArrayIterator <> (ArrayHelper.newArray ("Hallo",
                                                                                                                     "Welt",
                                                                                                                     "from",
                                                                                                                     "Copenhagen")));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:24,代码来源:ArrayIteratorTest.java


示例17: newQueueMapped

import com.helger.commons.collection.ArrayHelper; //导入依赖的package包/类
@Nonnull
@ReturnsMutableCopy
public static <SRCTYPE, DSTTYPE> PriorityQueue <DSTTYPE> newQueueMapped (@Nullable final SRCTYPE [] aArray,
                                                                         @Nonnull final Function <? super SRCTYPE, DSTTYPE> aMapper)
{
  if (ArrayHelper.isEmpty (aArray))
    return newQueue (0);
  final PriorityQueue <DSTTYPE> ret = newQueue (aArray.length);
  for (final SRCTYPE aValue : aArray)
    ret.add (aMapper.apply (aValue));
  return ret;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:13,代码来源:QueueHelper.java


示例18: newQueue

import com.helger.commons.collection.ArrayHelper; //导入依赖的package包/类
@Nonnull
@ReturnsMutableCopy
@SafeVarargs
public static <ELEMENTTYPE> PriorityQueue <ELEMENTTYPE> newQueue (@Nullable final ELEMENTTYPE... aValues)
{
  // Don't user Arrays.asQueue since aIter returns an unmodifiable list!
  if (ArrayHelper.isEmpty (aValues))
    return newQueue (0);

  final PriorityQueue <ELEMENTTYPE> ret = newQueue (aValues.length);
  Collections.addAll (ret, aValues);
  return ret;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:14,代码来源:QueueHelper.java


示例19: newVectorMapped

import com.helger.commons.collection.ArrayHelper; //导入依赖的package包/类
@Nonnull
@ReturnsMutableCopy
public static <SRCTYPE, DSTTYPE> CommonsVector <DSTTYPE> newVectorMapped (@Nullable final SRCTYPE [] aArray,
                                                                          @Nonnull final Function <? super SRCTYPE, DSTTYPE> aMapper)
{
  if (ArrayHelper.isEmpty (aArray))
    return newVector (0);
  final CommonsVector <DSTTYPE> ret = newVector (aArray.length);
  ret.addAllMapped (aArray, aMapper);
  return ret;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:12,代码来源:VectorHelper.java


示例20: newVector

import com.helger.commons.collection.ArrayHelper; //导入依赖的package包/类
@Nonnull
@ReturnsMutableCopy
@SafeVarargs
public static <ELEMENTTYPE> CommonsVector <ELEMENTTYPE> newVector (@Nullable final ELEMENTTYPE... aValues)
{
  // Don't user Arrays.asVector since aIter returns an unmodifiable list!
  if (ArrayHelper.isEmpty (aValues))
    return newVector (0);

  return new CommonsVector <> (aValues);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:12,代码来源:VectorHelper.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CtIf类代码示例发布时间:2022-05-23
下一篇:
Java ClassOutlineImpl类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap