Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Threads
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Threads and Synchronization
Lambda expression
Santosh Kumar Nayak
Ranch Hand
Posts: 230
I like...
posted 6 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
public class RunnableLambdaExample { public static void main(String[] args) { System.out.println(Thread.currentThread().getName() + ": RunnableTest"); Runnable task1 = new Runnable(){ @Override public void run(){ System.out.println(Thread.currentThread().getName() + " is running"); } }; Thread thread2 = new Thread(new Runnable() { @Override public void run(){ System.out.println(Thread.currentThread().getName() + " is running"); } }); Runnable task3 = () -> { System.out.println(Thread.currentThread().getName() + " is running"); }; Thread thread1 = new Thread(task1); thread1.start(); thread2.start(); new Thread(task3).start(); } }
Using Lambda expression. Does it have any improvement with respect to time complexity ?
Like better performance with respect to older ways of creating threads ?
Tim Moores
Saloon Keeper
Posts: 7585
176
posted 6 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
No. Used like this, they are merely a syntactical device. The effective code being executed is the same.
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Thread synchronization
Query about ScheduledThreadPoolExecutor.scheduleAtFixedRate
Threads
Need Explanation of unpredicted output even if methods are synchronized
locking??
More...