groupby functionality in java

groupby functionality in java

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
class Groupby{
    BufferedReader readexistingfile = null;
    String oldfileline;
    BufferedWriter writenewline = null;
    BufferedReader readnewfile = null;
    ArrayList<String> stringList = new ArrayList<String>();
    public void duplicate(String filename) {
        try {
        readexistingfile = new BufferedReader(new FileReader(filename));
        while((oldfileline = readexistingfile.readLine()) != null){
            //System.out.println("?????????"+oldfileline);
            //ArrayList<Integer> arry[] = oldfileline.split(",");
            newfile(oldfileline);
        }
        }catch(FileNotFoundException fnot){}
        catch(IOException io){}
        finally{
            try {                
                if(readexistingfile != null)readexistingfile.close();               
            } catch (IOException ex) {
                ex.printStackTrace();
            }   
        }
    }
    public void newfile(String line) {
        //System.out.println("------"+line);
        try {
        // boolean flag = false;
        writenewline = new BufferedWriter(new FileWriter("d://groupfile.txt"));
        //readnewfile = new BufferedReader(new FileReader("d://groupfile.txt"));

        stringList.add(line);

         for(int i=0;i<stringList.size();i++) {
                    //System.out.println("loop"+stringList.size());
               if(!(stringList.get(i).equals(line))) {
                    System.out.println("equals"+line);
                     writenewline.write(line);
                     writenewline.newLine();
                     writenewline.flush();  
                    }
               else{
                   break;
               }
               }         
        } catch(IOException io){}
    }
    public static void main(String arg[]){
        Groupby group = new Groupby();
        group.duplicate("d://raju.txt");        
    }
}
View Answers









Related Tutorials/Questions & Answers:
groupby functionality in java
groupby functionality in java  import java.io.BufferedReader; import... java.util.ArrayList; class Groupby{ BufferedReader readexistingfile = null...){} } public static void main(String arg[]){ Groupby group = new Groupby
groupby implement in java
groupby implement in java  **import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.Arrays
Advertisements
groupby implement in java
groupby implement in java  **import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.Arrays
Functionality of the stub
Functionality of the stub  hii,, What is the functionality of the stub?   hiiADS_TO_REPLACE_1 Stub: Stub is a client side representative. The functionality of stub is Marshalling and Unmarshalling in RMI(Remote
sms functionality
sms functionality  i want to implement sms functionality in web site for sending as well as receiving.i am using jsp and xamp as backend.please guide me
Undo/Redo functionality in UITexView
Undo/Redo functionality in UITexView  Hi all, I m facing a big problem from some days, actually i want to integrate the Undo/redo functionality in iphone app, where m using a textview. Please tell me the proper sample that where
search functionality with in application
search functionality with in application  I have created on web based web site in struts. i want to give user functionality for search any link with in my application. for that i have created one textbox and one submit
Disabling Login Functionality
this onclick functionality when the user is already in session. I am using onclick
WHAT IS THE FUNCTIONALITY OF THE FUNCTIONS STRSTR() AND STRISTR()?
WHAT IS THE FUNCTIONALITY OF THE FUNCTIONS STRSTR() AND STRISTR()?  WHAT IS THE FUNCTIONALITY OF THE FUNCTIONS STRSTR() AND STRISTR
What is the functionality of MD5 function in PHP?
What is the functionality of MD5 function in PHP?  What is the functionality of MD5 function in PHP
Version of com.transficc>transficc-functionality dependency
List of Version of com.transficc>transficc-functionality dependency
search functionality using jsp from database
search functionality using jsp from database  search functionality using jsp from database
Maven Dependency transficc-functionality >> 1.0.1
You should include the dependency code given in this page to add Maven Dependency of com.transficc >> transficc-functionality version1.0.1 in your project
Maven Dependency transficc-functionality >> 1.0.0
You should include the dependency code given in this page to add Maven Dependency of com.transficc >> transficc-functionality version1.0.0 in your project
How to write a search functionality using javascript/jquery
How to write a search functionality using javascript/jquery   How to write a search functionality using javascript/jquery for ex: im searching "s" names it wil display "s" names
how to add pageup page down functionality in scrolpane
how to add pageup page down functionality in scrolpane  how to add pageup page down functionality in scrolpane. In my GUI untill i dont click on screen area , the page up & pagedown button not works . what should i do to make
Select functionality of drop down list - Struts
Select functionality of drop down list  Hi, I have to write a code(in struts application) in which if user select HIDE from the drop down list... need the complete code,Do we need to write java script or not reqird Thanks
Maven Repository/Dependency: com.transficc | transficc-functionality
Maven Repository/Dependency of Group ID com.transficc and Artifact ID transficc-functionality. Latest version of com.transficc:transficc-functionality dependencies. # Version Release Date
Using Hibernate Functionality and pass it on to the JCAPS Oracle eWay - Hibernate
Using Hibernate Functionality and pass it on to the JCAPS Oracle eWay  Hi All, I need to use the Existing Hibernate API's and pass it on to the JCAPS oracle eWay to persist the Data. As the present Application is using
DB2 Universal claims to support JDBC 2.0, But I can only get JDBC 1.0 functionality.
DB2 Universal claims to support JDBC 2.0, But I can only get JDBC 1.0 functionality.  DB2 Universal claims to support JDBC 2.0, But I can only get JDBC 1.0 functionality. What can I do
How to add "View more results" kind of functionality in my PHP based website?
How to add "View more results" kind of functionality in my PHP based website?   Hi, I want to make a website which will recommend users books according to the genre selected by them. I am using PHP, JavaScript and mySQL
Hibernate Criteria GroupBy Example
Hibernate Criteria GroupBy Example In this Example, We will discuss about hibernate criteria query, The class org.hibernate.criterion.Projections ... roseindia.util.HibernateUtil; public class Criteria_GroupBy_Example { public static
Match the name with a description of purpose or functionality, for each of the following deployment descriptor elements: ejb-name, abstract-schema-name, ejb-relation, ejb-relat
Match the name with a description of purpose or functionality... or functionality, for each of the following deployment descriptor elements... Java identifier and MUST be UNIQUE within the ejb-jar file
Iterator Java Tutorial
Java Iterator is an interface in the collection framework It traverses through all the elements of the collection. It works like enumeration. It has... . Example of Java Iterator import java.util.*; public class iterator1
Java Iterator with Example
Iterator is an interface in the collection framework It traverses through all the elements of the collection. It works like enumeration. It has methods hasNext() and next(). Java Iterator Example import java.util.
Java Glossary Term - J
Java Glossary Term - J       Java DB Java DB is an open source Apache Derby database supported by Sun. Java DB is completely written in the Java programming language having
Java API
Java API what is Java API? API stands for Application Programming Interface, an API can define how a programmer can access a functionality within a library of code. Java Application Programming Interface is a library of classes
Basic Components & Functionality of LBS
Basic Components & Functionality of LBS       Mobile Device: Consists of basic electronic instruments like mobile phone, smart phone, laptop and other personal digital
Java example program to get the environment variable
Java example program to get the environment variable       java get environment variable The getenv() method of the java.lang.System provide us the functionality to get
What are Chained Exceptions?
What are Chained Exceptions in Java?   ... causes an another exception, that is termed as Chained Exception. Java provides new functionality for chaining exceptions. Exception chaining (also
Example of Variable Support Tags of JSTL Core Tag Library
Example of Variable Support Tags of JSTL Core Tag Library       JSTL( Java Sever pages Standard Tag Library) provide simple tags of core functionality that are used in many web
Java Conversion
Java Conversion       In this section we are going to learn about the type conversion in Java. The term Type Conversion is Java is used for the coding process where
Log4J Tutorials: Using Log4J in Easy Steps
Log4J Tutorials: Using Log4J in Easy Steps Log4j is a logging library for Java... Software Foundation. Log4j is one of best Java logging frameworks used by the developers for inserting logging functionality in the projects and add log
Java package
Java package       Introduction to Java Package Package is a mechanism for organizing a group... into  different directories according to their functionality, usability
Multicast Server in Java
Multicast Server in Java       This section introduces how to receive and send the IP packet by the multicast server and provides the functionality
Event on Slide bar In Java
Event on Slide bar In Java       Introduction In this section, you will learn about the event... solution for the appropriate functionality by providing a program.ADS_TO_REPLACE_1
June 2008 Issue of Java Jazz up magazine
June 2008 Issue of Java Jazz up magazine     ... popular. Web Services allows you to expose the functionality of your... Source web services tool in java The intention
Tomahawk Tags
with extended functionality and supports all the existing JSF components with additional sets of functionality. Some tomahawk tags are described in the subsequent sections
JSF Tags - Tomahawk Tags
with extended functionality and many more extra set of components with rich set of functionality. If you are going to create a web application in JSF then Tomahawk
JAVA
JAVA   I M building a media player using jframes using libraries of jmf and done with all things but left with some problems.. 1) not able show the timing of song.. 2) not able to volume functionality
Tomahawk Tags
Tomahawk Tags         Tomahawk tags are collection of standard components with extended functionality and many more extra set of components with rich set of functionality
Oracle Books
and detailed look at the many Oracle tools that support XML development shows Java..., functionality, and reliability of the Oracle database. The nearly 800 pages... with JDeveloper 3.1, an integrated development environment for Java developers. 
Calendar Example
Calendar Example       In this section, we are discussing the entire functionality... is the output: C:\Examples>java CalendarExample Current date
ArgoEclipse
ArgoUML functionality is available tightly integrated with the IDE... includes the following functionality: Support for all seven UML 1.4 diagram... is to provide seamless integration between the UML functionality provided by the core
Tomahawk pannelTab tag
for the tab. CSS and Java Script can be used with the help of attributes of this tag to give it look and functionality. Code Description : ... for Java Script code to be invoked when the element is double-clicked
Techniques used for Generating Dynamic Content Using Java Servlets.
Web Services benefits
the functionality of your existing code over the network. Once it is exposed on the network, other application can use the functionality of your program.ADS... of the web services. For example VB or .NET application can talk to java web
Quick introduction to web services
the functionality of your existing code over the network. Once it is exposed on the network, other application can use the functionality of your... application can talk to java web services and vice versa. So, Web
Convert Byte to Hexadecimal
into a hexadecimal number. The package java.lang provides the functionality... this program.ADS_TO_REPLACE_2 C:\corejava>java ByteToHexa
Java search from sqlservr
Java search from sqlservr  Hi I am a newbie to java . I know there are a lot of example on search functionality from Db , but can some please help me to implement search functionality where sql server is backend. Thanks  

Ads