How to add contents of hashset to file?

guys, i need to write hashset data to file..
here is my code:
HashSet<String> hs = new HashSet<String>();
File outfile3= new File("C:\\test.txt");           
FileWriter of3 = (new FileWriter(outfile3));
               Iterator it = hs.iterator();
               while (it.hasNext()) {
                    String t = it.next(); <=error
                    of3.write(t);
error : Type mismatch: cannot convert from Object to String
help me out guys..
thanx in advance..

add contents of hashset to file
... write hashset data to file
... new FileWriter(outfile3)Is it write or append? If append: I think FileWriter accepts an optional boolean append parameter.
of3.write(t);Try this:
of3.write(String.valueOf(t));... and BTW "wrapping" your FileWriter in a BufferedWriter improves throughput.
Cheers. Keith.

Similar Messages

  • How to add content source in office 365 ?

    How to add content source in office 365 , where I can add find Manage Content Sources page to click on New Content Source LInk

    You can't. Only sources available is what is already set up...which is SharePoint/OneDrive4B and Exchange via eDiscovery.
    Thanks,
    Mikael Svenson - Search Enthusiast
    SharePoint MVP/MCPD/P-TSP - If you find an answer useful, please up-vote it.
    http://techmikael.blogspot.com/
    Author of
    SharePoint Search Queries Explained and
    Working with FAST Search Server 2010 for SharePoint

  • How to add a table to pdf file ?

    How to add a table to pdf file ?
    Not able to use the table component. Its not active.
    Any help pls
    Thanks
    Peter
    http://www.ethos.ag

    http://forum.java.sun.com/faq.jsp#format

  • How to add xmp metadata to dae files

    How to add metadatas to 3D dae files...?
    The cad file used as an entry, the 2D files used as textures, environment, shaders...etc?

    Hi,
    Yes sorry about the "Acrobat Tag" , the question was more for the CS6 suite, and the management of DAE files in Bridge and Photoshop Extended in a CQ5 DAM workspace.
    But nevertheless, it should be cool if Acrobat X 3D could import directly Collada files...

  • How to read contents of a property file sequentially

    hello all,
    please can any one tell me how to read contents of a property file sequentially.
    i saw most of the classes provided by JAVA API, which get All keys and there return type is enumeration which dosent preserve , or may the getKeys() method of those classes do not preserve the sequential order.
    Kindly do let me know if anyone has done this before.
    Thanks.

    The best solution is that you redesign your program so that it does not depend on the order of the entries in the properties file.
    If you really want to stay with your design, you will have to read the properties file yourself, line by line, just like you would read any other text file, and parse the content of each line yourself.
    BufferedReader in = new BufferedReader(new FileReader("stuff.properties"));
    String line;
    while ((line = in.readLine()) != null) {
        // Parse the line, use e.g. String.split() to split it around the '='
    in.close();

  • Easy way to add content from a last file like a word document?

    Is there somebody who can tell me how i can display content from a word file.
    I have files with content inside on my network for example a word document.
    Inside this document i've got hyperlinks to content on other pages from the same document. Is the a way or a method how i can display the content in the portal.
    Do i need to cut and paste the word content of should i save the content as a XML or a HTML document and then add the document to portal
    Regards
    Andre

    Yeah, I have an idea... Have you tried the pdf export yet? If it is already formated then that maybe the way to go. But you may need acrobat to save it in another format. If I recall InDesign renders the pdf, which would make editing the pdf in Indesign useless.
    OK, did a quick test with PDF. Load the PDF into Acrobat and save as a word file. Place the word file into InDesign and you will have the styles paragraphs.    You just have to alter the style taste, may be fix a few paragraphs if needed.

  • How to add contents of an arrayList to a JList

    Hi,
    I am trying to figure out how to add the contents of an arraylist to a Jlist.
    Basically I have 3 classes which are as follow:
    1. AuctionItems(String name, int bid) which represents an item in auction
    2. AuctionItemsFactory which creates AuctionItems and adds them to an arraylist called stock
    3. AuctionBidsGui1 which is the interface where the user can see the items in the auction and select them from a JList.
    But I dont know how to read the contents of the stock(arraylist) into the JList which is in AuctionBidsGui1. Below are the 3 classes mentioned above
    public class AuctionItems {
         String name;
         int bid;
         public AuctionItems(){
              name = null;
              bid = 0;
         public AuctionItems(String name, int bid){
              this.name = name;
              this.bid = bid;
         public String getName(){
              return name;
         public int getBid() {
              return bid;
    public class AuctionItemsFactory {
         private ArrayList<AuctionItems> stock;
         int size;
         public AuctionItemsFactory() {
              stock = new ArrayList<AuctionItems>();
         public void addItems(AuctionItems item) {
              stock.add(item);
    //removes last element of the arrayList
         public void removeItems() {
              int n = stock.size() - 1;
              stock.remove(n);
         public void printNumOfItems() {
              int n = stock.size();
              System.out.println(n);
         public int numberOfItems(){
              return stock.size();
         public void printItems(){
              for (AuctionItems item : stock) System.out.println(item);
    and this one is a small part of the AuctionBidsGui1 class which represents the JList where the list of the items will go.
    public void addItemListWidgets() {
              itemsList = new JList();
              itemsList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
              itemsList.setLayoutOrientation(JList.VERTICAL);
              itemsList.setVisibleRowCount(10);
              itemsList.setSelectedIndex(0);
              JScrollPane itemsListScroller = new JScrollPane(itemsList); // put the list in the scroller
              itemsListScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
              itemsListScroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
              itemsListPanel.add(itemsListScroller);
         }

    I know that I have to use the toArray() but i dont know what type of method to use for this because i will need to implement a method in my AuctionItemsFactory class which will copy the contents of the arraylist into an array so then i can call this methos from my AuctionBidGui1 class.
    I would appreciate if you could give me a bit more hints.

  • How to add a locally stored video file to a presentation

    Hi all ,
    I want to add a locally stored video file to a presentation .What is the url that i need to use..
    Ur help is much appreciated
    Thanks

    The recommended procedure is to create the presentation on the DMM (upload the video to the DMM) then create a deployment package using the presentation created on the DMM. Once you deploy it to the DMP, the DMM will FTP the video along with presentation files to the DMP which will contain the links to play the video that will be stored locally on the DMP.
    You may want to review the following thread to see how to trigger the local presentation to play and how to update it later:
    https://supportforums.cisco.com/message/3289668
    Regards,
    Fabio Bergamo
    Cisco TAC

  • How to delete contents of a csv file except header using powershell

    Hi,
    I am trying to delete all the content of my csv file except its header. currently I am using clear-content but using this headers are also getting deleted. Basically I need a command which deletes all the rows of a csv file except first row.Please help.

    I'm only going to respond to prove that the useless troll is useless and wrong.
    Perhaps someday the troll will finally realize that it is worthless and will go away. No one cares about what it has to say and no one has ever found it to be helpful. Even good information is bad information when it is presented in an insulting, blathering,
    incoherent, and belittling tone. Plus, I think it's really funny when something tries to justify its own sad existence by making itself feel superior (when it clearly isn't). Sometimes I almost feel bad for it, but then it reminds me of how big of a jerk it
    really is.
    Get a life, get some friends, just go do something that isn't totally worthless (yeah, I know, you can't..).
    Don't retire TechNet! -
    (Don't give up yet - 12,700+ strong and growing)

  • How to Add Content Editor WebPart in PageLayout

    Hi
    I have copied the Content Editor webpart snippet and pasted it in my Page layout.
    But nothing is showing in page edit mode. 
    Can anyone tell me how to add this if the following is not correct?
    <div style="width:100%">
                    <div data-name="WebPartZone">
                        <!--CS: Start Content Editor Snippet--><!--SPM:<%@Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint,
    Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>--><!--MS:<WebPartPages:ContentEditorWebPart xmlns:WebPartPages="namespace" runat="server" webpart="true">--><!--PS: Start of READ-ONLY
    PREVIEW (do not modify)--><div class="ms-webpart-chrome ms-webpart-chrome-fullWidth "><div class="ms-webpart-chrome-title" id="WebPart_ChromeTitle"><span title="$Resources:core,ContentEditorWebPartTitle;
    - $Resources:core,ContentEditorWebPartDescription;" id="WebPartTitle" class="js-webpart-titleCell"><h2 style="text-align:justify;" class="ms-webpart-titleText"><nobr><span>$Resources:core,ContentEditorWebPartTitle;</span><span
    id="WebPartCaption"></span></nobr></h2></span></div><div WebPartID="00000000-0000-0000-0000-000000000000" HasPers="true" id="WebPart" width="100%" class="ms-WPBody ms-WPBorder
    noindex ms-wpContentDivSpace " OnlyForMePart="true" allowDelete="false" style=""><div class="ms-rtestate-field"></div><div class="ms-clear"></div></div></div><!--PE:
    End of READ-ONLY PREVIEW--><!--MS:<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">--><!--MS:<Title>--><!--SPM:$Resources:core,ContentEditorWebPartTitle;--><!--ME:</Title>--><!--MS:<Description>--><!--SPM:$Resources:core,ContentEditorWebPartDescription;--><!--ME:</Description>--><!--MS:<PartImageLarge>--><!--SPM:/_layouts/15/images/mscontl.gif--><!--ME:</PartImageLarge>--><!--MS:<ID>--><!--SPM:g_4998626c_cd3f_4f31_962c_51e943923c4f--><!--ME:</ID>--><!--ME:</WebPart>--><!--ME:</WebPartPages:ContentEditorWebPart>--><!--CE:
    End Content Editor Snippet-->
                    </div>
                </div>
    S H A J A N

    Hi  ,
    For adding the Content Editor Web Part to a SharePoint Layout , you can add the  code between the <Zonetemplate> tags:
    <!-- CEWP -->
    <WebPartPages:ContentEditorWebPart ID="ContentEditorWebPart1" runat="server" __MarkupType="xmlmarkup" WebPart="true" __WebPartId="{F40E10C3-ED3A-473D-8538-996344EE795C}" >
    <WebPart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/WebPart/v2">
    <Title>Content Editor Web Part</Title>
    <FrameType>TitleBarOnly</FrameType>
    <Description>Use for formatted text, tables, and images.</Description>
    <IsIncluded>true</IsIncluded>
    <PartOrder>2</PartOrder>
    <FrameState>Normal</FrameState>
    <Height />
    <Width />
    <AllowRemove>true</AllowRemove>
    <AllowZoneChange>true</AllowZoneChange>
    <AllowMinimize>true</AllowMinimize>
    <AllowConnect>true</AllowConnect>
    <AllowEdit>true</AllowEdit>
    <AllowHide>true</AllowHide>
    <IsVisible>true</IsVisible>
    <DetailLink />
    <HelpLink />
    <HelpMode>Modeless</HelpMode>
    <Dir>Default</Dir>
    <PartImageSmall />
    <MissingAssembly>Cannot import this Web Part.</MissingAssembly>
    <PartImageLarge>/_layouts/images/mscontl.gif</PartImageLarge>
    <IsIncludedFilter />
    <ExportControlledProperties>true</ExportControlledProperties>
    <ConnectionID>00000000-0000-0000-0000-000000000000</ConnectionID>
    <ID>g_f40e10c3_ed3a_473d_8538_996344ee795c</ID>
    <ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" />
    <Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor"><![CDATA[Edit this text.]]></Content>
    <PartStorage xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" />
    </WebPart>
    </WebPartPages:ContentEditorWebPart>
    For more information, you can refer to the thread:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/1ba645f2-2481-4560-a4c3-3be9f9e878bc/adding-the-content-editor-web-part-to-a-sharepoint-layout-aspx-page?forum=sharepointcustomizationlegacy
    http://hiren-j-patel.blogspot.com/2012/07/hello-all-today-we-will-add-content.html
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • How to load content of my text file into a Vector?

    Hi!
    Two questions.
    Let say I have used BufferedReader(new FileReader(c:/java/MyText.txt)) to read from MyText.txt file. I want to know how to load content of this file (every line describe each photo in my photo-set) into a Vector? And how to associate lines of MyText.txt as an elements of the Vector?
    I am trying to do something, but no results.
    try{
    BufferedReader reader = new BufferedReader(new FileReader("c:/java/Applications/MyText.txt"));
    String str=reader.readLine();
    JList myList = new JList();
    StringTokenizer st = new StringTokenizer(str,"\n");
    Vector vr = new Vector(25);
    while(st.hasMoreTokens()){
    String nextToken = st.nextToken();
    vr.addElement(nextToken);
    myList.setListData(vr);
    TA1.setText(TA1.getText()+
    (String)myList.getSelectedValue());
    }catch(IOException evt) {};

    BufferedReader reader = new BufferedReader(new FileReader("c:/java/Applications/MyText.txt"));
    Vector photos = new Vector(0,0);
    while(reader.ready())
       photos.addElement(reader.readLine());
    }good luck,
    Felipe

  • How to convert content of a Text file to String?

    Hi,
    I need to read the content of a text file and convert it into String and display it on to a JSP file.
    But the codings below don't work. Please advise me on how can i display the text file content.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    File adCheck = new File("list.txt");
    fis = new FileInputStream(adCheck);
    int Length = adCheck.length();
    byte arr[] = new byte[Length];
    int dataRead = 0;
    int totalData = 0;
    while(totalData <Length)
         dataRead = fis.read(arr,totalData,Length);
         totalData += dataRead;
    String Content = new String(arr);//byte array converted to String
    arr = null;

    Take a BufferReader:
    BufferedReader read = new BufferedReader(new FileReader("c:\test.txt");
    String temp = read.readln();
    You can make loops etc. Adding new Strings to an ArrayList,
    adding Strings etc....

  • How to add url to a png file in fireworks?

    I am making a web banner that is 728X90. I want to add a url to the banner so that when you click on it, no matter what state it is on, the link will take you to the website? I just started using fireworks 3 days ago. Please explain in the simplest of terms how to add the url to the banner.
    Also when I drag the file to a new window in Chrome to preview it some of the elements are resized and out of place. How can I fix this?

    Here is a link to the file.
    file:///C:/Users/ACIJ/Pictures/Working%20Product.swf
    See how the words are going off of the banner. In Fireworks its fine. The words all fit but when it shows up in the browser it does not fit.

  • How to add a LLB as a file to a project?

    Hello,
    I will add a LLB as a file to a project.
    If I add the LLB into the project explorer the LLB will be include as a folder and not as a file.
    I found the following description on the NI homepage:
    You also can add an LLB to a project as a file. If you add an LLB as a file, the VIs in the LLB do not appear in the Project Explorer window.
    Right-click the target or a folder under the target, select Add File from the shortcut menu, and use the file dialog box to navigate to the LLB you want to add.
    Select the open folder icon labeled VI with a single period to the right and click the Select button.
    But when I navigate to the LLB, I don't have an icon labeled VI.
    Have anybody an idea or can check this please?
    greetings
    Sascha

    So Sacha, you should probably add a vi inside the llb and then manually edit the .lvproj file..... (or wait until the not too distant future, is the not too distant past)
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • How to show content in a pdf file on swf

    I have a project Flash, that i want show content in a pdf file on swf file, but i don't know to show it
    So, who body help me ?
    Thanks!

    you can load your pdf into your browser using
    navigateToURL(new URLRequest("yourpdf.pdf"));

Maybe you are looking for

  • Can't Authenticate in LDAP directory after upgrade from 10.4.11 to 10.5.1

    Hi, all Yesterday I have tried to upgrade my Xserve Intel from 10.4.11 Tiger to 10.5.1 Leopard Server In my server there is this service: -AFP -DNS -SMB -Open Directory Master - XSAN Primary MDC All works fine but when I try to acces with worgroup ma

  • Audigy 2 zs diagnostics: only front left & right sound on megaworks 550

    When I test the speakers with creative thx console, creative diagnostics or spekaers settings, I can hear front left and right sound on my 5. system for EVERY channel that is tested. All the software is updated and speakers are connected in the right

  • Which cameras are compatible with the capture feature in adobe premiere pro?

    My son is making stop motion videos and wants to be able to use the capture feature on adobe premiere pro where you connect your camera via USB and can capture images on your computer through your camera. I'm looking into buying him a camera and am t

  • Layer Pallet issues with CS5 files in CS6

    Opening Illustrator CS5 files in CS6 causes the visibilty icons, layer names, and layer thumbnails to disappear  from the layers pallet. Objects are still there as are the layers and sub layers but I am unable to identify them in the layers pallet (s

  • Images not displaying since Beta 2/VS 2013

    My app contains dropboxes with links to some pages , these pages contain a background and an image that fill the most of the page. My problem is : since the update of Siena beta 2/VS 2013 2 dropboxes / 3 works correctly but one leads to the pages wit