Which one is recommended for SYNC on storage device?

2014-07-26 Thread Behrooz Nobakht
Hi, Prior to Java 7, we'd use FileOutputStream fos = new FileOutputStream(f); fos.write(...) fos.getFD().sync(); As of Java 7, we can say: OutputStream os = Files.newOutputStream(path, StandardOpenOption.SYNC); Regarding the behavior and the integrity, which one is more recommended? Or, are bo

What is the type of a "method reference"?

2013-06-11 Thread Behrooz Nobakht
Hi, I have a question regarding the method references in Java 8. Let's say that I have a class: class MyClass { Object doSomething(Object o); } And, I'm using the method reference MyClass::doSomething in a call such as SomeOtherClass.doAnotherThing(p, MyClass::doSomething). In this call, let

Re: What is the type of a "method reference"?

2013-06-12 Thread Behrooz Nobakht
? On Wed, Jun 12, 2013 at 10:22 AM, Florian Weimer wrote: > On 06/11/2013 11:50 PM, Behrooz Nobakht wrote: > >> My question is that how should the method doAnotherThing be declared? >> > > In most cases, it is appropriate to define an interface with a single > metho

Re: What is the type of a "method reference"?

2013-06-13 Thread Behrooz Nobakht
not, any suggestion to approach it? Such as MethodHandle? Thanks again! Behrooz On Wed, Jun 12, 2013 at 11:12 AM, Remi Forax wrote: > On 06/12/2013 10:35 AM, Behrooz Nobakht wrote: > >> Thanks for the reply. Just a follow-up question regarding the fact that >> method r