Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners groupby functionality in java
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


muralanagaraju
groupby functionality in java
0 Answer(s)      a year and 9 months ago
Posted in : Java Beginners


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");        
    }
}

Advertisement
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?   hii Stub: Stub is a client side representative. The functionality of stub is Marshalling and Unmarshalling in RMI(Remote method invocation
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 MD5 function in PHP?
What is the functionality of MD5 function in PHP?  What is the functionality of MD5 function in PHP
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
search functionality using jsp from database
search functionality using jsp from database  search functionality using jsp from database
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
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
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
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
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 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
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
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
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
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
Java Conversion
Java Conversion      ... the functionality to convert  a decimal number into a binary number.  ... into hexadecimal. The java.lang package provides the functionality to convert a decimal
Java package
Java package       Introduction to Java Package Package is a mechanism for organizing a group... into  different directories according to their functionality, usability
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
 

 

 

DMCA.com