Listing and filtering directory content using Java NIO2

java-thumbnail

The Files class provides a method- newDirectoryStream to get the Directory contents for a give path instance. There are other overloaded versions of newDirectoryStream method which take in filters to apply on the directory content. also read: Java 7.0 Tutorials New Features in Java 7.0 G1 Garbage Collector in Java 7.0 Listing all files in […]

Playing with reduceLeft, reduceRight, foldLeft, foldRight API in Scala

scala-thumbnail

In our previous post we saw in detail about the foreach. map, flatMap and collect methods in the Iterable trait. In this post we will look into detail about reduceLeft, reduceRight, foldLeft, foldRight methods of the Iterable trait. These methods are almost similar in the way the operate on the collection so it should be […]

Creating Hard links and Soft links for a file in Java

java-thumbnail

We have been exploring the NIO enhancements in Java 7 and in this post I will explain about creating links- Hard links and Soft links in Java. And this feature is part of Java 7. also read: Java 7.0 Tutorials New Features in Java 7.0 G1 Garbage Collector in Java 7.0 A link is kind […]

Playing with Collections API in Scala

scala-thumbnail

While I was going through the Scala collections API, I found the mere reading through the method and its functionality is not going to help. And I also realised that it will be useful if I can document them. And with that idea, I will try to document the APIs which I have tried. Please […]

Obtaining and modifying the metadata of the files in Java 7 NIO.2

java-thumbnail

Files usually contain information like its creation time, last modified time, last accessed time, size, type, permissions, ownership and other details which constitute its metadata. NIO.2 enhancements in Java 7 adds views to obtain metadata information of the file. The file attributes are grouped into different views based on their relatedness and applicability, for example […]

Exploring the Path API – Java NIO enhancement in Java 7

java-thumbnail

All of us know that an instance of File doesn’t indicate a file in the file system, unless some one invokes a create or related methods. But its a kind of confusion- you talk about instance of File and then you also talk about file at the disk level. A new class was introduced in […]

Functions as First Class Citizens in Scala

scala-thumbnail

In Java (Java 7 and before) we can store an object reference in a variable or some primitive value in which case Classes and Primitive types are the first class citizens there, but in Scala we can assign method/function definitions to variables, we can pass around function definitions to other functions and we can even […]

Using Apply and Unapply Methods in Scala

scala-thumbnail

Before we proceed to learn about Apply and Unapply methods, its good to know what a companion object is. A companion object in Scala for some class say Fraction is defined as: One can provide apply(args) and unapply(args) methods in the companion objects which can be used implemented to some special operations in Scala. Suppose […]

Traits in Scala- Advanced concepts

scala-thumbnail

In our previous article we covered very basic concepts on traits. In this article we will expand on our initial work and explore the inherent power of traits. As we said here just like the Interfaces traits can have abstract methods. Also traits can extend other traits just like Interfaces can extend other interfaces. also […]

Traits in Scala

scala-thumbnail

Java doesn’t allow multiple inheritance for the fear of Deadly Diamond of Death. And to circumvent this Java introduced interfaces where in a class can extend only one other class, but implement multiple interfaces. These interfaces don’t contain any implementations. (This is going to change with Defender Methods in Java 8). Lot of other languages […]