本文整理了Java中java.lang.Object.<init>()
方法的一些代码示例,展示了Object.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Object.<init>()
方法的具体详情如下:
包路径:java.lang.Object
类名称:Object
方法名:<init>
暂无
代码示例来源:origin: stackoverflow.com
function delay() {
// `delay` returns a promise
return new Promise(function(resolve, reject) {
// Only `delay` is able to resolve or reject the promise
setTimeout(function() {
resolve(42); // After 3 seconds, resolve the promise with value 42
}, 3000);
});
}
delay().then(function(v) { // `delay` returns a promise
console.log(v); // Log the value once it is resolved
}).catch(function(v) {
// Or do something else if it is rejected
// (it would not happen in this example, since `reject` is not called).
});
代码示例来源:origin: stackoverflow.com
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
startActivity(browserIntent);
代码示例来源:origin: stackoverflow.com
final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
}
代码示例来源:origin: stackoverflow.com
String url = "http://www.example.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
代码示例来源:origin: ReactiveX/RxJava
@Override
public Object apply(final Object integer) throws Exception {
return new Object();
}
})
代码示例来源:origin: ReactiveX/RxJava
@Override
public void subscribe(Observer<? super Object> innerObserver) {
innerObserver.onSubscribe(Disposables.empty());
push(innerObserver, new Object(), 50);
push(innerObserver, new Object(), 200);
complete(innerObserver, 250);
}
});
代码示例来源:origin: ReactiveX/RxJava
@Override
public Flowable<Object> apply(Object opening) {
return Flowable.unsafeCreate(new Publisher<Object>() {
@Override
public void subscribe(Subscriber<? super Object> subscriber) {
subscriber.onSubscribe(new BooleanSubscription());
push(subscriber, new Object(), 100);
complete(subscriber, 101);
}
});
}
};
代码示例来源:origin: ReactiveX/RxJava
@Override
public void subscribe(Observer<Object> observer) {
observer.onSubscribe(Disposables.empty());
push(observer, new Object(), 50);
push(observer, new Object(), 200);
complete(observer, 250);
}
});
代码示例来源:origin: ReactiveX/RxJava
@Override
public Observable<Object> apply(Object opening) {
return Observable.unsafeCreate(new ObservableSource<Object>() {
@Override
public void subscribe(Observer<? super Object> observer) {
observer.onSubscribe(Disposables.empty());
push(observer, new Object(), 100);
complete(observer, 101);
}
});
}
};
代码示例来源:origin: ReactiveX/RxJava
@Override
public Observable<Object> apply(Object opening) {
return Observable.unsafeCreate(new ObservableSource<Object>() {
@Override
public void subscribe(Observer<? super Object> innerObserver) {
innerObserver.onSubscribe(Disposables.empty());
push(innerObserver, new Object(), 100);
complete(innerObserver, 101);
}
});
}
};
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("unchecked")
@Test
public void shouldNotInvokeFuncUntilSubscription() throws Exception {
Callable<Object> func = mock(Callable.class);
when(func.call()).thenReturn(new Object());
Single<Object> fromCallableSingle = Single.fromCallable(func);
verifyZeroInteractions(func);
fromCallableSingle.subscribe();
verify(func).call();
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("unchecked")
@Test
public void shouldNotInvokeFuncUntilSubscription() throws Exception {
Callable<Object> func = mock(Callable.class);
when(func.call()).thenReturn(new Object());
Observable<Object> fromCallableObservable = Observable.fromCallable(func);
verifyZeroInteractions(func);
fromCallableObservable.subscribe();
verify(func).call();
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("unchecked")
@Test
public void shouldNotInvokeFuncUntilSubscription() throws Exception {
Callable<Object> func = mock(Callable.class);
when(func.call()).thenReturn(new Object());
Flowable<Object> fromCallableFlowable = Flowable.fromCallable(func);
verifyZeroInteractions(func);
fromCallableFlowable.subscribe();
verify(func).call();
}
代码示例来源:origin: stackoverflow.com
String url = "url you want to download";
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
request.setDescription("Some descrition");
request.setTitle("Some title");
// in order for this if to run, you must use the android 3.2 to compile your app
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
}
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "name-of-the-file.ext");
// get download service and enqueue file
DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
manager.enqueue(request);
代码示例来源:origin: ReactiveX/RxJava
@Test
public void reduceMaybeCheckDisposed() {
TestHelper.checkDisposed(Observable.just(new Object()).reduce(new BiFunction<Object, Object, Object>() {
@Override
public Object apply(Object a, Object b) throws Exception {
return a;
}
}));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void justUnsubscribed() throws Exception {
o = new Object();
WeakReference<Object> wr = new WeakReference<Object>(o);
TestObserver<Long> to = Observable.just(o).count().toObservable().onTerminateDetach().test();
o = null;
to.cancel();
System.gc();
Thread.sleep(200);
Assert.assertNull("Object retained!", wr.get());
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void flatMapError() {
RuntimeException exception = new RuntimeException("test");
Single.error(exception).flatMap(new Function<Object, SingleSource<Object>>() {
@Override public SingleSource<Object> apply(final Object integer) throws Exception {
return Single.just(new Object());
}
})
.test()
.assertError(exception);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void flatMapSingleError() {
RuntimeException exception = new RuntimeException("test");
Maybe.error(exception).flatMapSingle(new Function<Object, SingleSource<Object>>() {
@Override public SingleSource<Object> apply(final Object integer) throws Exception {
return Single.just(new Object());
}
})
.test()
.assertError(exception);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void flatMapMaybeError() {
RuntimeException exception = new RuntimeException("test");
Single.error(exception).flatMapMaybe(new Function<Object, MaybeSource<Object>>() {
@Override public MaybeSource<Object> apply(final Object integer) throws Exception {
return Maybe.just(new Object());
}
})
.test()
.assertError(exception);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void flatMapSingleElementError() {
RuntimeException exception = new RuntimeException("test");
Maybe.error(exception).flatMapSingleElement(new Function<Object, SingleSource<Object>>() {
@Override public SingleSource<Object> apply(final Object integer) throws Exception {
return Single.just(new Object());
}
})
.test()
.assertError(exception);
}
内容来源于网络,如有侵权,请联系作者删除!