Codota Logo
Utils.getNumPart
Code IndexAdd Codota to your IDE (free)

How to use
getNumPart
method
in
com.hortonworks.streamline.common.util.Utils

Best Java code snippets using com.hortonworks.streamline.common.util.Utils.getNumPart (Showing top 2 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Dictionary d =
  • Codota Iconnew Hashtable()
  • Codota IconBundle bundle;bundle.getHeaders()
  • Codota Iconnew Properties()
  • Smart code suggestions by Codota
}
origin: hortonworks/streamline

/**
 * Returns the latest name from a given list of names that matches the given prefix and suffix part.
 * <p>
 *     E.g.
 *     {@code getLatestName(["test-foo2", "test-foo10", "other", "test-foo1"], "test", "-foo") returns "test-foo10"}
 * </p>
 * @param names
 * @param prefix
 * @param suffix
 * @return
 */
public static Optional<String> getLatestName(Collection<String> names, String prefix, String suffix) {
  return names.stream()
      .filter(n -> n.startsWith(prefix))
      .max((n1, n2) -> Utils.getNumPart(n1, suffix) - Utils.getNumPart(n2, suffix));
}
/**
origin: hortonworks/streamline

/**
 * Generates the next name for the given name and suffix.
 * <p>
 * E.g. {@code getNextName("test-foo", "-foo") returns "test-foo2",
 *      getNextName("test-foo2", "-foo") returns "test-foo3"}
 * </p>
 * @param name the current name
 * @param suffix the suffix without the number part
 * @return the next name
 */
public static String getNextName(String name, String suffix) {
  Utils.requireNonEmpty(name, "Empty name");
  String prefix;
  String suffixWithNum;
  int num = getNumPart(name, suffix);
  if (num == -1) {
    prefix = name;
    suffixWithNum = suffix;
  } else {
    prefix = getPrefix(name, suffix);
    suffixWithNum = suffix + (num + 1);
  }
  return prefix + suffixWithNum;
}
com.hortonworks.streamline.common.utilUtilsgetNumPart

Javadoc

Gets the number part a string with a given suffix part.

E.g. getNumPart("test-foo2", "-foo") returns 2,

Popular methods of Utils

  • getSchemaFromConfig
    This method takes in a schema represented as a map and returns a Schema
  • requireNonEmpty
    Checks that the given string is not null or empty. Throws an IllegalArgumentException if it is.
  • getPrefix
    Gets the prefix part a string with a given suffix part. E.g. getPrefix("test-foo", "-foo") returns "
  • createObjectFromJson
    Deserialize a json string to a java object
  • getLatestName
    Returns the latest name from a given list of names that matches the given prefix and suffix part. E.
  • getNextName
    Generates the next name for the given name and suffix. E.g. getNextName("test-foo", "-foo") returns

Popular in Java

  • Start an intent from android
  • findViewById (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • Color (java.awt)
    The Color class is used encapsulate colors in the default sRGB color space or colors in arbitrary co
  • InetAddress (java.net)
    This class represents an Internet Protocol (IP) address. An IP address is either a 32-bit or 128-bit
  • StringTokenizer (java.util)
    The string tokenizer class allows an application to break a string into tokens. The tokenization met
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now