Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
946 connectés 

  FORUM HardWare.fr
  Programmation
  Java

  Comment peut t'on concatener 2 object[ ] ???

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Comment peut t'on concatener 2 object[ ] ???

n°663927
toufleboss
Posté le 05-03-2004 à 10:00:05  profilanswer
 

Object[] val = (Object[]) staticStrategy.get(id) + (Object[]) dynamicStrategy.get(id);
 
En gros que concat les objets sans avoir a parcourir à l'arrache .

mood
Publicité
Posté le 05-03-2004 à 10:00:05  profilanswer
 

n°663932
darklord
You're welcome
Posté le 05-03-2004 à 10:06:10  profilanswer
 

euh tu fais des get sur un tableau d'objet toi? [:mlc]

n°663937
lorill
Posté le 05-03-2004 à 10:08:18  profilanswer
 

DarkLord a écrit :

euh tu fais des get sur un tableau d'objet toi? [:mlc]


mais nan, c'est son get qui lui retourne un Object[]  [:ziiio]

n°663952
darklord
You're welcome
Posté le 05-03-2004 à 10:19:23  profilanswer
 

ah vi :jap:
ptain mal réveillé moi :sweat:

n°663994
benou
Posté le 05-03-2004 à 10:38:15  profilanswer
 

Code :
  1. Object[] t1 = ...;
  2. Object[] t2 = ...;
  3. // concaténation
  4. Object[] total = new Object[t1.length + t2.length] ;
  5. System.arrayCopy(t1, 0, total, 0, t1.length);
  6. System.arrayCopy(t2, 0, total, t1.length, t2.length);


---------------
ma vie, mon oeuvre - HomePlayer
n°664081
therier
heu...coucou!
Posté le 05-03-2004 à 11:24:06  profilanswer
 

benou a écrit :

Code :
  1. Object[] t1 = ...;
  2. Object[] t2 = ...;
  3. // concaténation
  4. Object[] total = new Object[t1.length + t2.length] ;
  5. System.arrayCopy(t1, 0, total, 0, t1.length);
  6. System.arrayCopy(t2, 0, total, t1.length, t2.length);




 
Tiens d'ailleurs, j'en profite pour signaler que j'ai eu des surprises des fois sur la methode System.arrayCopy() sur des JVM exotiques(SCOpar exemple) : crash de la JVM entre autre.


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Java

  Comment peut t'on concatener 2 object[ ] ???

 

Sujets relatifs
[K.D.KOL] runtime class d'un Object et polymorphisme[VB Excel] Concaténer ok ! mais "déconcaténer" une String ?
Appler une méthode C++ dans un shared objectBusiness object
univers Bussiness object[c] difference object, library, archive
[VBA] [DEBUTANT] Inclure la réf Microsoft Word x.x Object Libraryvisual object cobol (visoc) ou le trouver ??
[batch] concaténer date et nom fichierBusiness Object en Open Source? ca existe?
Plus de sujets relatifs à : Comment peut t'on concatener 2 object[ ] ???


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR