Best code examples for Java 8 String class (java.lang.String)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 String class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Java 8 String examples from Open Source projects
This code example shows how to use the following methods: charAt, length, replaceAll, substring, valueOf
30:	String packageName = filePath.replaceAll("\\\\|-|\\.|/", "_"); 
31:	clazz = Class.forName(packageName + "." + getPackageClassName(packageName)); 
-
42:	return Character.toUpperCase(packageName.charAt(0)) + packageName.substring(1, packageName.length()) + "Package"; 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: equals
38:	String propVal=new String("both"); 
-
48:	if (propVal.equals("treeonly") | propVal.equals("both")) { 
-
51:	if (propVal.equals("tableonly") | propVal.equals("both")) { 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods:
34:	static public String fieldStaticString = new String("helloworld"); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: equals
108:	if (engine.equals(INTERNET_EXPLORER)) 
-
111:	if (engine.equals(OPERA)) 
-
114:	if (engine.equals(FIREFOX)) 
-
117:	if (engine.equals(CHROME)) 
-
120:	if (engine.equals(SAFARI)) 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: equals
41:	if (propValue.equals("treeonly") | propValue.equals("tableonly") | propValue.equals("both") | propValue.equals("none")) { 
-
48:	if (propVal.equals("treeonly") | propVal.equals("both")) { 
-
51:	if (propVal.equals("tableonly") | propVal.equals("both")) { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: charAt, equals
79:	switch (method.charAt(5)) { 
-
81:	if (method.equals("_get_EJBHome")) { 
-
85:	if (method.equals("remove")) { 
-
89:	if (method.equals("_get_handle")) { 
-
93:	if (method.equals("isIdentical")) { 
-
97:	if (method.equals("_get_primaryKey")) { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: equals, length
83:	switch (method.length()) { 
-
85:	if (method.equals("create")) { 
-
89:	if (method.equals("_get_homeHandle")) { 
-
93:	if (method.equals("_get_EJBMetaData")) { 
-
97:	if (method.equals("remove__java_lang_Object")) { 
-
99:	} else if (method.equals("remove__javax_ejb_Handle")) { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods:
113:	Edit ed = new Edit(1, length (), DNATools.createDNA(new String(seqString))); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: indexOf, substring
188:	int domainNameSeparatorIndex = username.indexOf(DOMAIN_NAME_SEPARATOR); 
-
190:	String domainName = username.substring(domainNameSeparatorIndex + 1); 
191:	tenantID = realmService.getTenantManager().getTenantId(domainName); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: equalsIgnoreCase
190:	if (cmd.equalsIgnoreCase("Forums")) { 
-
193:	if (cmd.equalsIgnoreCase("Vote")) { 
-
196:	if (cmd.equalsIgnoreCase("Donate")) { 
-
199:	if (cmd.equalsIgnoreCase("Exit")) { 
-
205:	if (cmd.equalsIgnoreCase("Item List")){ 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: trim
156:	return cassandraAdminStub.getColumnFamilyOfCurrentUser(keyspaceName, cfName); 
-
421:	if (columnFamilyName == null || "".equals(columnFamilyName.trim())) { 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: equals, valueOf
59:	if(!"".equals(host) && !"".equals(port)) 
-
61:	hostList=host + ":" + port; 
-
63:	else if("".equals(host) && "".equals(port)) 
-
69:	if("".equals(host)) 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: equals
23:	if ( attr_name.equals ( "id" ) ) { 
-
27:	else if ( attr_name.equals ( "mirrorpath" ) ) { 
-
31:	else if ( attr_name.equals ( "typemask" ) ) { 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: replaceAll
57:	return ISOUtil.hex2byte(hexString.replaceAll(" ", "")); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: indexOf, substring, valueOf
39:	String filePath = className.substring(0,className.indexOf(WEBINF) + WEBINF.length()); 
-
49:	xml = filePath + "/repository_db.xml"; 
-
51:	xml = filePath + "/repository.xml"; 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: lastIndexOf, substring, valueOf
31:	int dotPos = s.lastIndexOf("."); 
-
34:	String result = s.substring(0, dotPos+1); 
35:	result = result + ext; 
-
41:	result = result + "." +ext; 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: charAt, length, valueOf
19:	if(str.length() == 1) 
-
21:	else if(str.length() > 1 && i < str.length()) 
-
23:	s = RevStr(str, i+1) + str.charAt(i); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setParseBigDecimal, parse
35:	DecimalFormat format = new DecimalFormat("#.#", symbols); 
36:	format.setParseBigDecimal(true); 
37:	return (BigDecimal) format.parse(source); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setCurrency, setMaximumFractionDigits, setMinimumFractionDigits, setParseBigDecimal, setRoundingMode
95:	format.setParseBigDecimal(true); 
96:	format.setMaximumFractionDigits(this.fractionDigits); 
97:	format.setMinimumFractionDigits(this.fractionDigits); 
-
99:	format.setRoundingMode(this.roundingMode); 
-
102:	format.setCurrency(this.currency); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: valueOf
219:	return getTypeName(typeElementRequiringScanning.getEnclosingElement()) + "$" + typeElementRequiringScanning.getSimpleName().toString(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getChars, length
12:	int len = str.length(); 
-
14:	str.getChars(0, len, data, 0); 
-
19:	return stringWidth(new java.lang.String(data, off, len)); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: applyPattern, setParseBigDecimal
78:	decimalFormat.setParseBigDecimal(true); 
-
80:	decimalFormat.applyPattern(this.pattern); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setParseBigDecimal, parse
61:	fmt.setParseBigDecimal(true); 
-
63:	return (BigDecimal) fmt.parse(value); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDecimalFormatSymbols, setDecimalFormatSymbols, setDecimalSeparatorAlwaysShown, setParseBigDecimal, parse
115:	DecimalFormat hbciFormat=new DecimalFormat("0.##"); 
116:	DecimalFormatSymbols symbols=hbciFormat.getDecimalFormatSymbols(); 
-
118:	hbciFormat.setDecimalFormatSymbols(symbols); 
119:	hbciFormat.setDecimalSeparatorAlwaysShown(true); 
120:	hbciFormat.setParseBigDecimal(true); 
-
122:	ret=HBCIUtils.bigDecimal2String((BigDecimal) hbciFormat.parse(c)); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: newKeyguardLock
15:	KeyguardLock lock = 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setDecimalSeparatorAlwaysShown, setParseBigDecimal, setParseIntegerOnly
178:	format = new DecimalFormat(pattern, decimalFormatSymbols); 
-
180:	format.setParseIntegerOnly(false); 
181:	format.setParseBigDecimal(false); 
182:	format.setDecimalSeparatorAlwaysShown(true); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: valueOf
61:	stmt.setString(1, userId + "_token"); 
-
65:	stmt.setString(5, userId); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setParseBigDecimal
58:	setFormatter(new DecimalFormat()); 
-
96:	dfmt.setParseBigDecimal(true); 
97:	super.setFormatter(dfmt); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setParseBigDecimal, parse
38:	df.setParseBigDecimal(true); 
39:	BigDecimal bd = (BigDecimal)df.parse(string.trim()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setDecimalFormatSymbols, setParseBigDecimal, parse
196:	return decimalFormat.parse(String.valueOf(o)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: applyPattern, getDecimalFormatSymbols, setDecimalFormatSymbols, setParseBigDecimal
81:	DecimalFormatSymbols dfs = decimalFormat.getDecimalFormatSymbols(); 
-
83:	decimalFormat.applyPattern("#0.0#"); 
-
87:	decimalFormat.setDecimalFormatSymbols(dfs); 
88:	decimalFormat.setParseBigDecimal(true); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isParseBigDecimal, setParseBigDecimal, isParseIntegerOnly, parse
136:	assertFalse(form.isParseBigDecimal()); 
137:	form.setParseBigDecimal(true); 
138:	assertTrue(form.isParseBigDecimal()); 
-
141:	Number result = form.parse("123.123"); 
-
147:	form.setParseBigDecimal(false); 
148:	assertFalse(form.isParseBigDecimal()); 
-
151:	Number result = form.parse("123.123"); 
-
158:	assertFalse(form.isParseIntegerOnly()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: valueOf
63:	out.print(mName + ": "); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getDimension, isPrimitiveArray, getClassName, getDescription, getTypeName
87:	if (a.getClassName().equals(className)) { 
-
94:	if (a.getDescription().equals(description)) { 
-
101:	if (a.getTypeName().equals(typeName)) { 
-
108:	if (a.isArray() == isArray) { 
-
115:	if (a.isPrimitiveArray() == isPrimitiveArray) { 
-
122:	if (a.getDimension() == dimension) { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setParseBigDecimal
161:	df.setParseBigDecimal(true); 
-
163:	return new NumericFormatterImpl(df); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: equals
130:	if (encodingFormat.equals(TICKFILE_FORMAT_TRADEBUILD_SQL)) encodingFormat = TICK_ENCODING_FORMAT_V1; 
131:	if (encodingFormat.equals(TICK_ENCODING_FORMAT_V1) || 
132:	encodingFormat.equals(TICK_ENCODING_FORMAT_V2)) { 
133:	return (TickDataDecoder) (new TickDataDecoderA(periodStartTime, basePrice, tickSize, encodingFormat, data)); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setParseBigDecimal, setRoundingMode
88:	this.decimalFormat = new DecimalFormat(pattern, new DecimalFormatSymbols(locale)); 
89:	this.decimalFormat.setParseBigDecimal(true); 
90:	this.decimalFormat.setRoundingMode(RoundingMode.HALF_UP); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isUsbMassStorageConnected
73:	final boolean connected = mStorageManager.isUsbMassStorageConnected(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: substring, toUpperCase, trim
66:	s = s.trim(); 
67:	char first = s.toUpperCase().charAt(0); 
68:	return "" + first + s.substring(1); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: newKeyguardLock
85:	mKeyguardLock = keyguardManager.newKeyguardLock(KEYGUARD_TAG); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: info, x 1
49:	log.info("entering EventSourceImpl.createBook()"); 
50:	log.info("EventSourceImpl firing processEvent"); 
-
55:	log.info("stored: " + id + "->" + book); 
56:	log.info("EventSourceImpl firing readProcessEvent"); 
-
58:	log.info("leaving EventSourceImpl.createBook()"); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: toLowerCase
39:	if (Strings.isNullOrEmpty(email) || Strings.isNullOrEmpty(username) || Strings.isNullOrEmpty(password)) { 
-
43:	return new User(username, email.toLowerCase(), password, /* is admin */ false); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: fine, info, log, severe
85:	log.fine("accept"); 
-
94:	log.info("connection from " + nm); 
-
103:	log.severe("registration error: " + re.getMessage()); 
104:	log.log(Level.FINE, "details: ", re); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: marshal, setProperty
53:	marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); 
54:	marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.FALSE); 
55:	marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); 
-
73:	marshaller.marshal(element,writer); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: newKeyguardLock
74:	keyguardManager.newKeyguardLock("imftest").disableKeyguard(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setParseBigDecimal
122:	DecimalFormat decimalFormat = new DecimalFormat("#,###.#####"); 
123:	decimalFormat.setParseBigDecimal(true); 
Full Snippet Info
5
CodeRank
Related Java 8 String Questions & Answers:
Other Java 8 String Examples
6:	public class SendMessageToDevice {
7:	
8:	  public static void main(String[] args) throws IOException {
9:	    // "Message to your device." is the message we will send to the Android app
10:	    int responseCode = MessageUtil.sendMessage(ServerConfiguration.AUTHENTICATION_TOKEN,

Read More

25:	        mCursor, // Pass in the cursor to bind to.
26:	        // Array of cursor columns to bind to.
27:	        new String[] { ContactsContract.Contacts._ID,
28:	            ContactsContract.Contacts.DISPLAY_NAME },
29:	        // Parallel array of which template objects to bind to those
-
38:	    // Run query
39:	    Uri uri = ContactsContract.Contacts.CONTENT_URI;
40:	    String[] projection = new String[] { ContactsContract.Contacts._ID,
41:	        ContactsContract.Contacts.DISPLAY_NAME };
42:	    String selection = ContactsContract.Contacts.IN_VISIBLE_GROUP + " = '"
-
38:	    // Run query
39:	    Uri uri = ContactsContract.Contacts.CONTENT_URI;
40:	    String[] projection = new String[] { ContactsContract.Contacts._ID,
41:	        ContactsContract.Contacts.DISPLAY_NAME };
42:	    String selection = ContactsContract.Contacts.IN_VISIBLE_GROUP + " = '"
-
40:	    String[] projection = new String[] { ContactsContract.Contacts._ID,
41:	        ContactsContract.Contacts.DISPLAY_NAME };
42:	    String selection = ContactsContract.Contacts.IN_VISIBLE_GROUP + " = '"
43:	        + ("1") + "'";
44:	    String[] selectionArgs = null;
-
42:	    String selection = ContactsContract.Contacts.IN_VISIBLE_GROUP + " = '"
43:	        + ("1") + "'";
44:	    String[] selectionArgs = null;
45:	    String sortOrder = ContactsContract.Contacts.DISPLAY_NAME
46:	        + " COLLATE LOCALIZED ASC";
-
43:	        + ("1") + "'";
44:	    String[] selectionArgs = null;
45:	    String sortOrder = ContactsContract.Contacts.DISPLAY_NAME
46:	        + " COLLATE LOCALIZED ASC";
47:

Read More

21:	    super.onCreate(savedInstanceState);
22:	    setContentView(R.layout.main);
23:	    wordList = new ArrayList<String>();
24:	    adapter = new ArrayAdapter<String>(this,
25:	        android.R.layout.simple_list_item_1, android.R.id.text1,
-
22:	    setContentView(R.layout.main);
23:	    wordList = new ArrayList<String>();
24:	    adapter = new ArrayAdapter<String>(this,
25:	        android.R.layout.simple_list_item_1, android.R.id.text1,
26:	        wordList);
-
57:	    }
58:	  };
59:	  private ArrayAdapter<String> adapter;
60:	  private List<String> wordList;
61:	
-
58:	  };
59:	  private ArrayAdapter<String> adapter;
60:	  private List<String> wordList;
61:	
62:	  public void onClick(View view) {

Read More

1:	
2:		// Logcat tag
3:		private static final String LOG = "DatabaseHelper";
4:	
5:		// Database Version
-
7:	
8:		// Database Name
9:		private static final String DATABASE_NAME = "contactsManager";
10:	
11:		// Table Names
-
10:	
11:		// Table Names
12:		private static final String TABLE_TODO = "todos";
13:		private static final String TABLE_TAG = "tags";
14:		private static final String TABLE_TODO_TAG = "todo_tags";
-
11:		// Table Names
12:		private static final String TABLE_TODO = "todos";
13:		private static final String TABLE_TAG = "tags";
14:		private static final String TABLE_TODO_TAG = "todo_tags";
15:	
-
12:		private static final String TABLE_TODO = "todos";
13:		private static final String TABLE_TAG = "tags";
14:		private static final String TABLE_TODO_TAG = "todo_tags";
15:	
16:		// Common column names
-
15:	
16:		// Common column names
17:		private static final String KEY_ID = "id";
18:		private static final String KEY_CREATED_AT = "created_at";
19:	
-
16:		// Common column names
17:		private static final String KEY_ID = "id";
18:		private static final String KEY_CREATED_AT = "created_at";
19:	
20:		// NOTES Table - column nmaes
-
19:	
20:		// NOTES Table - column nmaes
21:		private static final String KEY_TODO = "todo";
22:		private static final String KEY_STATUS = "status";
23:	
-
20:		// NOTES Table - column nmaes
21:		private static final String KEY_TODO = "todo";
22:		private static final String KEY_STATUS = "status";
23:	
24:		// TAGS Table - column names
-
23:	
24:		// TAGS Table - column names
25:		private static final String KEY_TAG_NAME = "tag_name";
26:	
27:		// NOTE_TAGS Table - column names
-
26:	
27:		// NOTE_TAGS Table - column names
28:		private static final String KEY_TODO_ID = "todo_id";
29:		private static final String KEY_TAG_ID = "tag_id";
30:	
-
27:		// NOTE_TAGS Table - column names
28:		private static final String KEY_TODO_ID = "todo_id";
29:		private static final String KEY_TAG_ID = "tag_id";
30:	
31:		// Table Create Statements
-
31:		// Table Create Statements
32:		// Todo table create statement
33:		private static final String CREATE_TABLE_TODO = "CREATE TABLE "
34:				+ TABLE_TODO + "(" + KEY_ID + " INTEGER PRIMARY KEY," + KEY_TODO
35:				+ " TEXT," + KEY_STATUS + " INTEGER," + KEY_CREATED_AT
-
37:	
38:		// Tag table create statement
39:		private static final String CREATE_TABLE_TAG = "CREATE TABLE " + TABLE_TAG
40:				+ "(" + KEY_ID + " INTEGER PRIMARY KEY," + KEY_TAG_NAME + " TEXT,"
41:				+ KEY_CREATED_AT + " DATETIME" + ")";
-
42:	
43:		// todo_tag table create statement
44:		private static final String CREATE_TABLE_TODO_TAG = "CREATE TABLE "
45:				+ TABLE_TODO_TAG + "(" + KEY_ID + " INTEGER PRIMARY KEY,"
46:				+ KEY_TODO_ID + " INTEGER," + KEY_TAG_ID + " INTEGER,"

Read More

6:		
7:		// give your server registration url here
8:	    static final String SERVER_URL = "http://10.0.2.2/gcm_server_php/register.php"; 
9:	
10:	    // Google project id
-
9:	
10:	    // Google project id
11:	    static final String SENDER_ID = "903913289319"; 
12:	
13:	    /**
-
14:	     * Tag used on log messages.
15:	     */
16:	    static final String TAG = "AndroidHive GCM";
17:	
18:	    static final String DISPLAY_MESSAGE_ACTION =
-
16:	    static final String TAG = "AndroidHive GCM";
17:	
18:	    static final String DISPLAY_MESSAGE_ACTION =
19:	            "com.androidhive.pushnotifications.DISPLAY_MESSAGE";
20:	
-
19:	            "com.androidhive.pushnotifications.DISPLAY_MESSAGE";
20:	
21:	    static final String EXTRA_MESSAGE = "message";
22:	
23:	    /**
-
30:	     * @param message message to be displayed.
31:	     */
32:	    static void displayMessage(Context context, String message) {
33:	        Intent intent = new Intent(DISPLAY_MESSAGE_ACTION);
34:	        intent.putExtra(EXTRA_MESSAGE, message);

Read More

3:	
4:		// URL to get contacts JSON
5:		private static String url = "http://api.androidhive.info/contacts/";
6:	
7:		// JSON Node names
-
6:	
7:		// JSON Node names
8:		private static final String TAG_CONTACTS = "contacts";
9:		private static final String TAG_ID = "id";
10:		private static final String TAG_NAME = "name";
-
7:		// JSON Node names
8:		private static final String TAG_CONTACTS = "contacts";
9:		private static final String TAG_ID = "id";
10:		private static final String TAG_NAME = "name";
11:		private static final String TAG_EMAIL = "email";
-
8:		private static final String TAG_CONTACTS = "contacts";
9:		private static final String TAG_ID = "id";
10:		private static final String TAG_NAME = "name";
11:		private static final String TAG_EMAIL = "email";
12:		private static final String TAG_ADDRESS = "address";
-
9:		private static final String TAG_ID = "id";
10:		private static final String TAG_NAME = "name";
11:		private static final String TAG_EMAIL = "email";
12:		private static final String TAG_ADDRESS = "address";
13:		private static final String TAG_GENDER = "gender";
-
10:		private static final String TAG_NAME = "name";
11:		private static final String TAG_EMAIL = "email";
12:		private static final String TAG_ADDRESS = "address";
13:		private static final String TAG_GENDER = "gender";
14:		private static final String TAG_PHONE = "phone";
-
11:		private static final String TAG_EMAIL = "email";
12:		private static final String TAG_ADDRESS = "address";
13:		private static final String TAG_GENDER = "gender";
14:		private static final String TAG_PHONE = "phone";
15:		private static final String TAG_PHONE_MOBILE = "mobile";
-
12:		private static final String TAG_ADDRESS = "address";
13:		private static final String TAG_GENDER = "gender";
14:		private static final String TAG_PHONE = "phone";
15:		private static final String TAG_PHONE_MOBILE = "mobile";
16:		private static final String TAG_PHONE_HOME = "home";
-
13:		private static final String TAG_GENDER = "gender";
14:		private static final String TAG_PHONE = "phone";
15:		private static final String TAG_PHONE_MOBILE = "mobile";
16:		private static final String TAG_PHONE_HOME = "home";
17:		private static final String TAG_PHONE_OFFICE = "office";
-
14:		private static final String TAG_PHONE = "phone";
15:		private static final String TAG_PHONE_MOBILE = "mobile";
16:		private static final String TAG_PHONE_HOME = "home";
17:		private static final String TAG_PHONE_OFFICE = "office";
18:	
-
15:		private static final String TAG_PHONE_MOBILE = "mobile";
16:		private static final String TAG_PHONE_HOME = "home";
17:		private static final String TAG_PHONE_OFFICE = "office";
18:	
19:		// contacts JSONArray

Read More

1:	@MediumTest
2:	public void testClickMeButton_clickButtonAndExpectInfoText() {
3:	    String expectedInfoText = mClickFunActivity.getString(R.string.info_text);
4:	    TouchUtils.clickView(this, mClickMeButton);
5:	    assertTrue(View.VISIBLE == mInfoTextView.getVisibility());

Read More

2:	AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.autocomplete_country);
3:	// Get the string array
4:	String[] countries = getResources().getStringArray(R.array.countries_array);
5:	// Create the adapter and set it to the AutoCompleteTextView 
6:	ArrayAdapter<String> adapter = 
-
4:	String[] countries = getResources().getStringArray(R.array.countries_array);
5:	// Create the adapter and set it to the AutoCompleteTextView 
6:	ArrayAdapter<String> adapter = 
7:	        new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, countries);
8:	textView.setAdapter(adapter);
-
5:	// Create the adapter and set it to the AutoCompleteTextView 
6:	ArrayAdapter<String> adapter = 
7:	        new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, countries);
8:	textView.setAdapter(adapter);
9:

Read More

11:	    assertTrue(isFinishCalled());
12:	
13:	    final String payload =
14:	            launchIntent.getStringExtra(NextActivity.EXTRAS_PAYLOAD_KEY);
15:	    assertEquals("Payload is empty", LaunchActivity.STRING_PAYLOAD, payload);

Read More

See Code Examples for Java 8 String Methods: