Tabnine Logo
Hashtable
Code IndexAdd Tabnine to your IDE (free)

How to use
Hashtable
in
java.util

Best Java code snippets using java.util.Hashtable (Showing top 20 results out of 33,417)

Refine searchRefine arrow

  • Enumeration
  • Vector
  • Properties
  • InternetAddress
  • PasswordAuthentication
  • MimeMessage
  • FileInputStream
origin: pentaho/pentaho-kettle

public String[] getUsedFields() {
 Hashtable<String, String> fields = new Hashtable<String, String>();
 getUsedFields( fields );
 String[] retval = new String[fields.size()];
 Enumeration<String> keys = fields.keys();
 int i = 0;
 while ( keys.hasMoreElements() ) {
  retval[i] = keys.nextElement();
  i++;
 }
 return retval;
}
origin: stackoverflow.com

this.password = password;   
Properties props = new Properties();   
props.setProperty("mail.transport.protocol", "smtp");   
props.setProperty("mail.host", mailhost);   
props.put("mail.smtp.auth", "true");   
props.put("mail.smtp.port", "465");   
props.put("mail.smtp.socketFactory.port", "465");   
props.put("mail.smtp.socketFactory.class",   
    "javax.net.ssl.SSLSocketFactory");   
props.put("mail.smtp.socketFactory.fallback", "false");   
props.setProperty("mail.smtp.quitwait", "false");   
return new PasswordAuthentication(user, password);   
MimeMessage message = new MimeMessage(session);   
DataHandler handler = new DataHandler(new ByteArrayDataSource(body.getBytes(), "text/plain"));   
message.setSender(new InternetAddress(sender));   
message.setSubject(subject);   
message.setDataHandler(handler);   
if (recipients.indexOf(',') > 0)   
  message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipients));   
else  
  message.setRecipient(Message.RecipientType.TO, new InternetAddress(recipients));   
Transport.send(message);   
}catch(Exception e){
origin: stackoverflow.com

 private static String getPostParamString(Hashtable<String, String> params) {
  if(params.size() == 0)
    return "";

  StringBuffer buf = new StringBuffer();
  Enumeration<String> keys = params.keys();
  while(keys.hasMoreElements()) {
    buf.append(buf.length() == 0 ? "" : "&");
    String key = keys.nextElement();
    buf.append(key).append("=").append(params.get(key));
  }
  return buf.toString();
}
origin: redisson/redisson

/**
 * Undocumented method.  Do not use; internal-use only.
 *
 * @param name      the name of <code>$cflow</code> variable
 */
public Object[] lookupCflow(String name) {
  if (cflow == null)
    cflow = new Hashtable();
  return (Object[])cflow.get(name);
}
origin: stackoverflow.com

 Hashtable<Integer, String> table = ...

Enumeration<Integer> enumKey = table.keys();
while(enumKey.hasMoreElements()) {
  Integer key = enumKey.nextElement();
  String val = table.get(key);
  if(key==0 && val.equals("0"))
    table.remove(key);
}
origin: log4j/log4j

public SortedKeyEnumeration(Hashtable ht) {
 Enumeration f = ht.keys();
 Vector keys = new Vector(ht.size());
 for (int i, last = 0; f.hasMoreElements(); ++last) {
  String key = (String) f.nextElement();
  for (i = 0; i < last; ++i) {
   String s = (String) keys.get(i);
   if (key.compareTo(s) <= 0) break;
  }
  keys.add(i, key);
 }
 e = keys.elements();
}
origin: stackoverflow.com

 Map<String, String> ldapContent = new HashMap<String, String>();
Properties properties = new Properties();
properties.load(new FileInputStream("data.properties"));

for (String key : properties.stringPropertyNames()) {
  ldapContent.put(key, properties.get(key).toString());
}
origin: stackoverflow.com

 public static void loadPropertiesAndParse() {
  Properties props = new Properties();
  String propsFilename = "path_to_props_file";
  FileInputStream in = new FileInputStream(propsFilename);
  props.load(in);
  Enumeration en = props.keys();
  while (en.hasMoreElements()) {
    String tmpValue = (String) en.nextElement();
    String path = tmpValue.substring(0, tmpValue.lastIndexOf(File.separator)); // Get the path
    String filename = tmpValue.substring(tmpValue.lastIndexOf(File.separator) + 1, tmpValue.length()); // Get the filename
  }
}
origin: pentaho/pentaho-kettle

    Properties properties = new Properties();
    properties.load( new FileInputStream( entry ) );
    files.put( filename, properties );
directories = new Hashtable<String, Integer>( files.size() );
locales = new Hashtable<String, Boolean>( 10 );
for ( String filename : files.keySet() ) {
 String path = getPath( filename );
 Integer num = directories.get( path );
 if ( num != null ) {
  num = Integer.valueOf( num.intValue() + 1 );
  num = Integer.valueOf( 1 );
 directories.put( path, num );
 locales.put( locale, Boolean.TRUE );
origin: log4j/log4j

Hashtable filters = new Hashtable();
Enumeration e = props.keys();
String name = "";
while (e.hasMoreElements()) {
 String key = (String) e.nextElement();
 if (key.startsWith(filterPrefix)) {
  int dotIdx = key.indexOf('.', fIdx);
   name = key.substring(dotIdx+1);
  Vector filterOpts = (Vector) filters.get(filterKey);
  if (filterOpts == null) {
   filterOpts = new Vector();
   filters.put(filterKey, filterOpts);
while (g.hasMoreElements()) {
 String key = (String) g.nextElement();
 String clazz = props.getProperty(key);
 if (clazz != null) {
  LogLog.debug("Filter key: ["+key+"] class: ["+props.getProperty(key) +"] props: "+filters.get(key));
  Filter filter = (Filter) OptionConverter.instantiateByClassName(clazz, Filter.class, null);
  if (filter != null) {
   PropertySetter propSetter = new PropertySetter(filter);
   Vector v = (Vector)filters.get(key);
   Enumeration filterProps = v.elements();
   while (filterProps.hasMoreElements()) {
    NameValue kv = (NameValue)filterProps.nextElement();
origin: wildfly/wildfly

orbProp = new Properties();
final Enumeration envProp = env.keys();
while (envProp.hasMoreElements()) {
  String key = (String) envProp.nextElement();
  Object val = env.get(key);
  if (val instanceof String) {
    orbProp.put(key, val);
final Enumeration mainProps = orbProperties.keys();
while (mainProps.hasMoreElements()) {
  String key = (String) mainProps.nextElement();
  Object val = orbProperties.get(key);
Object applet = env.get(Context.APPLET);
if (applet != null) {
origin: h2oai/h2o-2

int dot = f.getCanonicalPath().lastIndexOf( '.' );
if ( dot >= 0 )
 mime = (String)theMimeTypes.get( f.getCanonicalPath().substring( dot + 1 ).toLowerCase());
if ( mime == null )
 mime = MIME_DEFAULT_BINARY;
String range = header.getProperty( "range" );
if ( range != null )
  FileInputStream fis = new FileInputStream( f ) {
   public int available() throws IOException { return (int)dataLen; }
  };
  try {
   fis.skip( startFrom );
   res.addHeader( "Content-Range", "bytes " + startFrom + "-" + endAt + "/" + fileLen);
   res.addHeader( "ETag", etag);
  } finally { fis.close(); }
 if (etag.equals(header.getProperty("if-none-match")))
  res = new Response( HTTP_NOTMODIFIED, mime, "");
 else
origin: apache/shiro

/**
 * Create a new JNDI initial context. Invoked by {@link #execute}.
 * <p>The default implementation use this template's environment settings.
 * Can be subclassed for custom contexts, e.g. for testing.
 *
 * @return the initial Context instance
 * @throws NamingException in case of initialization errors
 */
@SuppressWarnings({"unchecked"})
protected Context createInitialContext() throws NamingException {
  Properties env = getEnvironment();
  Hashtable icEnv = null;
  if (env != null) {
    icEnv = new Hashtable(env.size());
    for (Enumeration en = env.propertyNames(); en.hasMoreElements();) {
      String key = (String) en.nextElement();
      icEnv.put(key, env.getProperty(key));
    }
  }
  return new InitialContext(icEnv);
}
origin: pentaho/pentaho-kettle

/**
 * @return all the extra options that are set to be used for the database URL
 */
@Override
public Map<String, String> getExtraOptions() {
 Map<String, String> map = new Hashtable<String, String>();
 for ( Enumeration<Object> keys = attributes.keys(); keys.hasMoreElements(); ) {
  String attribute = (String) keys.nextElement();
  if ( attribute.startsWith( ATTRIBUTE_PREFIX_EXTRA_OPTION ) ) {
   String value = attributes.getProperty( attribute, "" );
   // Add to the map...
   map.put( attribute.substring( ATTRIBUTE_PREFIX_EXTRA_OPTION.length() ), value );
  }
 }
 return map;
}
origin: robovm/robovm

/**
 * Reset configuration.
 *
 * <p>All handlers are closed and removed from any named loggers. All loggers'
 * level is set to null, except the root logger's level is set to
 * {@code Level.INFO}.
 */
public synchronized void reset() {
  checkAccess();
  props = new Properties();
  Enumeration<String> names = getLoggerNames();
  while (names.hasMoreElements()) {
    String name = names.nextElement();
    Logger logger = getLogger(name);
    if (logger != null) {
      logger.reset();
    }
  }
  Logger root = loggers.get("");
  if (root != null) {
    root.setLevel(Level.INFO);
  }
}
origin: robovm/robovm

if ((null == v) || (v.size() < 1))
 return false;
for (int i = 0; i < v.size(); i++)
 Hashtable subhash = (Hashtable) v.elementAt(i);
 for (Enumeration keys = subhash.keys(); 
    keys.hasMoreElements();
  Object key = keys.nextElement();
  try
   node.setAttribute("name", keyStr.substring(0, keyStr.indexOf("-")));
   node.setAttribute("desc", keyStr.substring(keyStr.indexOf("-") + 1));
   node.appendChild(factory.createTextNode((String)subhash.get(keyStr)));
   container.appendChild(node);
origin: log4j/log4j

 v = new Vector(); 
 Enumeration enumeration = ht.keys();
 while(enumeration.hasMoreElements() && (misses <= 4)) {
Thread t = (Thread) enumeration.nextElement();
if(t.isAlive()) {
 misses++;
} else {
 misses = 0;
 v.addElement(t);
int size = v.size();
for(int i = 0; i < size; i++) {
 Thread t = (Thread) v.elementAt(i);
 LogLog.debug("Lazy NDC removal for thread [" + t.getName() + "] ("+ 
    ht.size() + ").");
 ht.remove(t);
origin: stackoverflow.com

 Properties prop = new Properties(); 
InputStream input   = SentmailAttachFile.class.getResourceAsStream("/Sendmail.properties");
        prop.load(input);

String receiver  = prop.getProperty("MAILADDRESS");
String mailCC        = prop.getProperty("MAILCC"); 

Properties props = new Properties();
  props.put("mail.smtp.host" , host);
  props.put("mail.smtp.auth" , "true" );
  props.put("mail.transport.protocol", "smtp");
  Session ss     = Session.getInstance(props,null);
  MimeMessage ms = new MimeMessage(ss);
  ms.addRecipient(Message.RecipientType.TO,new InternetAddress(receiver));
  ms.addRecipient(Message.RecipientType.CC, new InternetAddress(mailCC));
origin: stackoverflow.com

  session = jsch.getSession(SFTPUSER, SFTPHOST, SFTPPORT);
  session.setPassword(SFTPPASS);
  java.util.Properties config = new java.util.Properties();
  config.put("StrictHostKeyChecking", "no");
  session.setConfig(config);
  session.connect();
  channelSftp.cd(SFTPWORKINGDIR);
  File f = new File(fileName);
  channelSftp.put(new FileInputStream(f), f.getName());
  log.info("File transfered successfully to host.");
} catch (Exception ex) {
origin: robovm/robovm

/**
 * Return an array containing the names of all currently defined
 * configuration attributes.  If there are no such attributes, a zero
 * length array is returned.
 */
public String[] getAttributeNames() {
  Vector names = new Vector();
  Enumeration keys = attributes.keys();
  while (keys.hasMoreElements()) {
    names.addElement((String) keys.nextElement());
  }
  String results[] = new String[names.size()];
  for (int i = 0; i < results.length; i++) {
    results[i] = (String) names.elementAt(i);
  }
  return (results);
}
java.utilHashtable

Javadoc

A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale_lib.NonBlockingHashMap. The undocumented iteration order is different from Hashtable, as is the undocumented (lack of) synchronization. Programs that rely on this undocumented behavior may break. Otherwise this solution should be completely compatible, including the serialized forms. This version is not synchronized, and correctly operates as a thread-safe Hashtable. It does not provide the same ordering guarantees as calling synchronized methods will. The old Hashtable's methods were synchronized and would provide ordering. This behavior is not part of Hashtable's spec. This version's methods are not synchronized and will not force the same Java Memory Model orderings.

Most used methods

  • <init>
    Constructs a new instance of Hashtable containing the mappings from the specified map.
  • put
    Maps the specified key to the specifiedvalue in this hashtable. Neither the key nor the value can be
  • get
    Returns the value to which the specified key is mapped, or null if this map contains no mapping for
  • remove
  • containsKey
    Returns true if this Hashtable contains the specified object as a key of one of the key/value pairs.
  • keys
    Returns an enumeration on the keys of this Hashtable instance. The results of the enumeration may be
  • size
    Returns the number of key/value pairs in this Hashtable.
  • clear
    Removes all key/value pairs from this Hashtable, leaving the size zero and the capacity unchanged.
  • keySet
    Returns a Set view of the keys contained in this map. The set is backed by the map, so changes to th
  • elements
    Returns an enumeration on the values of this Hashtable. The results of the Enumeration may be affect
  • values
    Returns a collection of the values contained in this Hashtable. The collection is backed by this Has
  • entrySet
    Returns a set of the mappings contained in this Hashtable. Each element in the set is a Map.Entry. T
  • values,
  • entrySet,
  • clone,
  • isEmpty,
  • putAll,
  • contains,
  • toString,
  • containsValue,
  • equals,
  • hashCode

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setContentView (Activity)
  • setScale (BigDecimal)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • JTable (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now