Java 8 Object - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Object class.

This code example shows how to use the following methods:toString, add
public class OffsetCompareProberTest { 
 
	@Test
	public void testFindAlertList(){ 
		OffsetCompareProber ocp = new OffsetCompareProber(null);
		List<String> alertList = new LinkedList<String>();
		alertList.add("defaultWW");
		 
		List<String> wwList = new LinkedList<String>();
		wwList.add("defaultWW");
		wwList.add("groupWW");
		 
		List<String> topicList = new LinkedList<String>();
		topicList.add("groupTopic");
		 
		List<String> ignoreTopicList = new LinkedList<String>();
		ignoreTopicList.add("groupTopicIgnore");
		 
		Group group = new Group();
		group.setGroup("group1");

9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getClass, format, getDateFormatSymbols, toPattern
    } 
 
    public void test_ConstructorLjava_lang_StringLjava_util_Locale() { 
        // Test for method java.text.SimpleDateFormat(java.lang.String, 
        // java.util.Locale) 
        SimpleDateFormat f2 = new SimpleDateFormat("'yyyy' MM yy",
                Locale.GERMAN);
        assertTrue("Wrong class", f2.getClass() == SimpleDateFormat.class);
        assertEquals("Wrong pattern", "'yyyy' MM yy", f2.toPattern());
        assertTrue("Wrong symbols", f2.getDateFormatSymbols().equals(
                new DateFormatSymbols(Locale.GERMAN)));
        assertTrue("Doesn't work",
                f2.format(new Date()).getClass() == String.class);
 
        try { 
            new SimpleDateFormat(null, Locale.GERMAN);
            fail("NullPointerException was not thrown.");
        } catch(NullPointerException npe) {
            //expected 
        } 
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:toString, add
public class OffsetCompareProberTest { 
 
	@Test 
	public void testFindAlertList(){ 
		OffsetCompareProber ocp = new OffsetCompareProber(null);
		List<String> alertList = new LinkedList<String>();
		alertList.add("defaultWW");
		 
		List<String> wwList = new LinkedList<String>();
		wwList.add("defaultWW");
		wwList.add("groupWW");
		 
		List<String> topicList = new LinkedList<String>();
		topicList.add("groupTopic");
		 
		List<String> ignoreTopicList = new LinkedList<String>();
		ignoreTopicList.add("groupTopicIgnore");
		 
		Group group = new Group();
		group.setGroup("group1");

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getContentDescription, getHeight, getId, getLocationOnScreen, getWidth
 
	@SuppressWarnings({ "rawtypes", "unchecked" }) 
	public static Object extractDataFromView(View v) {		
		 
		Map data = new HashMap();
		data.put("class", v.getClass().getName());		
		data.put("description", v.toString());
		CharSequence description = v.getContentDescription();
		data.put("contentDescription", description != null ? description.toString() : null);
		data.put("enabled", v.isEnabled());
		String id = null;
		try { 
			id = InstrumentationBackend.solo.getCurrentActivity()
					.getResources().getResourceEntryName(v.getId());
		} catch (Resources.NotFoundException e) {
			System.out.println("Resource not found for " + v.getId()
					+ ". Moving on."); 
		} 
		data.put("id", id);
 

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getActivity, getApplicationContext, getClass
 
	private MoSyncNFCForegroundUtil(Activity activity, NfcAdapter nfc) {
	    this.activity = activity;
	    this.nfc = nfc;
 
	    intent = PendingIntent.getActivity(activity, 0, new Intent(activity, activity.getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
 
	    // TODO: NDEF!? 
	    IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED);
 
//	    try { 
//	        ndef.addDataType("*/*"); 
//	    } catch (MalformedMimeTypeException e) { 
//	        throw new RuntimeException("Unable to speciy */* Mime Type", e); 
//	    } 
 
	    intentFilters = new IntentFilter[] { ndef };
 
	    // TODO: READ FROM NFC.XML OR SMTHG 
	    techLists = new String[][] {

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getClass
	 * the local name of the supplied {@link Node}. Supports both {@link Element Elements} 
	 * and {@link Attr Attrs}. 
	 */ 
	private BeanDefinitionDecorator findDecoratorForNode(Node node, ParserContext parserContext) {
		BeanDefinitionDecorator decorator = null;
		String localName = parserContext.getDelegate().getLocalName(node);
		if (node instanceof Element) {
			decorator = this.decorators.get(localName);
		} 
		else if (node instanceof Attr) {
			decorator = this.attributeDecorators.get(localName);
		} 
		else { 
			parserContext.getReaderContext().fatal(
					"Cannot decorate based on Nodes of type [" + node.getClass().getName() + "]", node);
		} 
		if (decorator == null) {
			parserContext.getReaderContext().fatal("Cannot locate BeanDefinitionDecorator for " +
					(node instanceof Element ? "element" : "attribute") + " [" + localName + "]", node);
		} 

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getClass, getNextException, getSQLState
 * @author Thomas Risberg 
 * @see java.sql.SQLException#getSQLState() 
 * @see SQLErrorCodeSQLExceptionTranslator 
 */ 
public class SQLStateSQLExceptionTranslator extends AbstractFallbackSQLExceptionTranslator { 
 
	private static final Set<String> BAD_SQL_GRAMMAR_CODES = new HashSet<String>(8); 
 
	private static final Set<String> DATA_INTEGRITY_VIOLATION_CODES = new HashSet<String>(8); 
 
	private static final Set<String> DATA_ACCESS_RESOURCE_FAILURE_CODES = new HashSet<String>(8); 
 
	private static final Set<String> TRANSIENT_DATA_ACCESS_RESOURCE_CODES = new HashSet<String>(8); 
 
	private static final Set<String> CONCURRENCY_FAILURE_CODES = new HashSet<String>(4); 
 
 
	static { 
		BAD_SQL_GRAMMAR_CODES.add("07");	// Dynamic SQL error 
		BAD_SQL_GRAMMAR_CODES.add("21");	// Cardinality violation 

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getSystemService, setVolumeControlStream, getClass
	 
	public void disableKeyguard(Activity activity) {
		if (mKeyguardLock != null) {
			mKeyguardLock.disableKeyguard();
		} else { 
			KeyguardManager keyguardManager = (KeyguardManager) activity.getSystemService(Activity.KEYGUARD_SERVICE);
			mKeyguardLock = keyguardManager.newKeyguardLock(KEYGUARD_TAG);
			mKeyguardLock.disableKeyguard();
		} 
	} 
	 
	public void enableKeyguard() { 
		if (mKeyguardLock != null) {
			mKeyguardLock.reenableKeyguard();
		} 
		mKeyguardLock = null;
	} 
 
 
	public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {

7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getClass
        } 
    } 
 
    @Override 
    protected void onRestoreInstanceState(Parcelable state) {
        if (!state.getClass().equals(SavedState.class)) {
            super.onRestoreInstanceState(state);
            return; 
        } 
        SavedState myState = (SavedState) state;
        super.onRestoreInstanceState(myState.getSuperState());
        mProgress = myState.progress;
        mMax = myState.max;
        notifyChanged(); 
    } 
 
    @Override 
    protected Parcelable onSaveInstanceState() {
        final Parcelable superState = super.onSaveInstanceState();
        if (isPersistent()) {
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:newWakeLock, getClass
	private final static int WAIT_FOR_PROXIMITY_NEGATIVE = 1;
	private final static int WAKE_UP_IMMEDIATELY = 0;
 
	public WakeLockManager(Context context){
		mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
		mFullLock = mPowerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK
											  | PowerManager.ACQUIRE_CAUSES_WAKEUP
											  | PowerManager.ON_AFTER_RELEASE, LOG_TAG);
		mPartialLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, LOG_TAG);
 
		// Check if PROXIMITY_SCREEN_OFF_WAKE_LOCK is implemented, not part of public api. 
		try { 
			Method method = mPowerManager.getClass().getDeclaredMethod("getSupportedWakeLockFlags");
			int supportedWakeLockFlags = (Integer) method.invoke(mPowerManager);
			Field field = PowerManager.class.getDeclaredField("PROXIMITY_SCREEN_OFF_WAKE_LOCK");
			int proximityScreenOffWakeLock = (Integer) field.get(null);
			if ((supportedWakeLockFlags & proximityScreenOffWakeLock) != 0x0) {
				mProximityLock = mPowerManager.newWakeLock(proximityScreenOffWakeLock, LOG_TAG);
			} 
		} catch (Exception e){

7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Java 8 Object Questions & Answers:

Other Java 8 Object Examples

9:	
10:	public class OverviewActivity extends Activity {
11:	  protected Object mActionMode;
12:	  @Override
13:	  public void onCreate(Bundle savedInstanceState) {

Read More

1:				@Override
2:				public void onComplete(String response, Object state) {
3:					Log.d("Logout from Facebook", response);
4:					if (Boolean.parseBoolean(response) == true) {
5:						// User successfully Logged out
-
9:				@Override
10:				public void onIOException(IOException e, Object state) {
11:				}
12:	
13:				@Override
-
14:				public void onFileNotFoundException(FileNotFoundException e,
15:						Object state) {
16:				}
17:	
18:				@Override
-
19:				public void onMalformedURLException(MalformedURLException e,
20:						Object state) {
21:				}
22:	
23:				@Override
-
23:				@Override
24:				public void onFacebookError(FacebookError e, Object state) {
25:				}
26:			});
27:		}

Read More

1:				@Override
2:				public void onComplete(String response, Object state) {
3:					Log.d("Profile", response);
4:					String json = response;
5:					try {
-
26:				@Override
27:				public void onIOException(IOException e, Object state) {
28:				}
29:	
30:				@Override
-
31:				public void onFileNotFoundException(FileNotFoundException e,
32:						Object state) {
33:				}
34:	
35:				@Override
-
36:				public void onMalformedURLException(MalformedURLException e,
37:						Object state) {
38:				}
39:	
40:				@Override
-
40:				@Override
41:				public void onFacebookError(FacebookError e, Object state) {
42:				}
43:			});
44:		}

Read More

36:	
37:		@Override
38:	    public boolean isViewFromObject(View view, Object object) {
39:	        return view == ((RelativeLayout) object);
40:	    }
-
41:		
42:		@Override
43:	    public Object instantiateItem(ViewGroup container, int position) {
44:	        ImageView imgDisplay;
45:	        Button btnClose;
-
72:		
73:		@Override
74:	    public void destroyItem(ViewGroup container, int position, Object object) {
75:	        ((ViewPager) container).removeView((RelativeLayout) object);
76:

Read More

10:	    }
11:	
12:	    public Object getItem(int position) {
13:	        return null;
14:	    }

Read More

See Code Examples for Java 8 Object Methods: