Reading from multiple files The Next CEO of Stack OverflowStandard concise way to copy a file in Java?Create ArrayList from arrayGet an OutputStream into a StringHow do I read / convert an InputStream into a String in Java?How do I create a Java string from the contents of a file?How do I save a String to a text file using Java?How do I check if a file exists in Java?Sort ArrayList of custom Objects by propertyReading a plain text file in JavaCan't execute jar- file: “no main manifest attribute”
What is the purpose of the Evocation wizard's Potent Cantrip feature?
Visit to the USA with ESTA approved before trip to Iran
When did Lisp start using symbols for arithmetic?
Return of the Riley Riddles in Reverse
What happens if you roll doubles 3 times then land on "Go to jail?"
Why does GHC infer a monomorphic type here, even with MonomorphismRestriction disabled?
How should I support this large drywall patch?
% symbol leads to superlong (forever?) compilations
Why didn't Khan get resurrected in the Genesis Explosion?
Should I tutor a student who I know has cheated on their homework?
Why Were Madagascar and New Zealand Discovered So Late?
Any way to transfer all permissions from one role to another?
How can I quit an app using Terminal?
How to make a software documentation "officially" citable?
Does the Brexit deal have to be agreed by both Houses?
Why do remote companies require working in the US?
Grabbing quick drinks
Anatomically Correct Strange Women In Ponds Distributing Swords
What makes a siege story/plot interesting?
How to safely derail a train during transit?
How to start emacs in "nothing" mode (`fundamental-mode`)
Solution of this Diophantine Equation
Implement the Thanos sorting algorithm
Is it my responsibility to learn a new technology in my own time my employer wants to implement?
Reading from multiple files
The Next CEO of Stack OverflowStandard concise way to copy a file in Java?Create ArrayList from arrayGet an OutputStream into a StringHow do I read / convert an InputStream into a String in Java?How do I create a Java string from the contents of a file?How do I save a String to a text file using Java?How do I check if a file exists in Java?Sort ArrayList of custom Objects by propertyReading a plain text file in JavaCan't execute jar- file: “no main manifest attribute”
In java, when I want to read data from multiple text files is it better to take the files names as strings and then use one file object to open, read and close files, or to create multiple file objects and go through them?
java
add a comment |
In java, when I want to read data from multiple text files is it better to take the files names as strings and then use one file object to open, read and close files, or to create multiple file objects and go through them?
java
1
You can't use one object to open multiple files. What are you trying to achieve?
– BackSlash
Mar 7 at 14:03
1
If you are asking what is better to re-use a local variable or create a preset number of different local variables (or some kind of collection), it really does not matter much since they are short-lived anyway.
– PM 77-1
Mar 7 at 14:07
1
You would require more memory at a moment of time in the second case. But what you wanna achieve would also influence your decision at choosing one of the approach.
– uneq95
Mar 7 at 14:17
add a comment |
In java, when I want to read data from multiple text files is it better to take the files names as strings and then use one file object to open, read and close files, or to create multiple file objects and go through them?
java
In java, when I want to read data from multiple text files is it better to take the files names as strings and then use one file object to open, read and close files, or to create multiple file objects and go through them?
java
java
asked Mar 7 at 14:01
joujou
1
1
1
You can't use one object to open multiple files. What are you trying to achieve?
– BackSlash
Mar 7 at 14:03
1
If you are asking what is better to re-use a local variable or create a preset number of different local variables (or some kind of collection), it really does not matter much since they are short-lived anyway.
– PM 77-1
Mar 7 at 14:07
1
You would require more memory at a moment of time in the second case. But what you wanna achieve would also influence your decision at choosing one of the approach.
– uneq95
Mar 7 at 14:17
add a comment |
1
You can't use one object to open multiple files. What are you trying to achieve?
– BackSlash
Mar 7 at 14:03
1
If you are asking what is better to re-use a local variable or create a preset number of different local variables (or some kind of collection), it really does not matter much since they are short-lived anyway.
– PM 77-1
Mar 7 at 14:07
1
You would require more memory at a moment of time in the second case. But what you wanna achieve would also influence your decision at choosing one of the approach.
– uneq95
Mar 7 at 14:17
1
1
You can't use one object to open multiple files. What are you trying to achieve?
– BackSlash
Mar 7 at 14:03
You can't use one object to open multiple files. What are you trying to achieve?
– BackSlash
Mar 7 at 14:03
1
1
If you are asking what is better to re-use a local variable or create a preset number of different local variables (or some kind of collection), it really does not matter much since they are short-lived anyway.
– PM 77-1
Mar 7 at 14:07
If you are asking what is better to re-use a local variable or create a preset number of different local variables (or some kind of collection), it really does not matter much since they are short-lived anyway.
– PM 77-1
Mar 7 at 14:07
1
1
You would require more memory at a moment of time in the second case. But what you wanna achieve would also influence your decision at choosing one of the approach.
– uneq95
Mar 7 at 14:17
You would require more memory at a moment of time in the second case. But what you wanna achieve would also influence your decision at choosing one of the approach.
– uneq95
Mar 7 at 14:17
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55045616%2freading-from-multiple-files%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55045616%2freading-from-multiple-files%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You can't use one object to open multiple files. What are you trying to achieve?
– BackSlash
Mar 7 at 14:03
1
If you are asking what is better to re-use a local variable or create a preset number of different local variables (or some kind of collection), it really does not matter much since they are short-lived anyway.
– PM 77-1
Mar 7 at 14:07
1
You would require more memory at a moment of time in the second case. But what you wanna achieve would also influence your decision at choosing one of the approach.
– uneq95
Mar 7 at 14:17