Show Some Love
JAVA

How to remove null from an array in java

This forum was posted on Wednesday, May 22, 2013 9:42:45 PM


I have written a method to delete null-values from an array i require in a program.
The method however does not appear to work the null values will not go away. it's my code snippet so far.

public void removeNull(String a)
{
for(int i=0; ii)
{
a2j=aj+1;
}
}
a=a2;
}

Thank You in advance!


63 Viewed this Question



 Recent Replies on "How to remove null from an array in java"

  • Nobody has replied on this post, be first to post answer.

Post Your Solution for this Question


Note: Please Put Code into <code></code> block.

Threads related to "How to remove null from an array in java":

How to get the value of a method argument via reflection in Java?

deal with this code snippet snippet:public void illustration(String s int i @Foo Bar bar) { /* ... */}I am interested in the value of the argument annotated with @Foo. Assume that I hv already figured out via reflection (with Method#getParameterAnnotations()) which method parameter has the @Foo annotation. (I know it is the third parameter of the parameter list.)How can i now recover the value of bar for further usage?

Sign CSR using Bouncy Castle

I can not find any code/doc describing How do I sign a CSR using BC. As input I hv a CSR as a byte array and would like to get the cert in PEM and/or DER format.I hv gotten this fardef signCSR(csrData:ArrayByte ca:CACertificate caPassword:String) = { val csr = new PKCS10CertificationRequestHolder(csrData) val spi = csr.getSubjectPublicKeyInfo val ks = new java.security.spec.X509EncodedKeySpec(spi.getDEREncoded()) val kf = java.security.KeyFactory.getInstance("RSA") val pk = kf.genera

Extending GenericModel for Play Framework

i require to add little logic to GenericModel by means of extending it but I understand that Play uses generics to enhance the GenericModel. What would be the right and most convenient approach to extend this class?I tried to do this but little of the methods in GenericModel simply throw a UnsupportedOperationException exception so this is clearly enhanced somewhere else.

Create graph Editor

i require to generate a graph editor written in Java.In this editor i require the chances that nodes can hold other nodes.The chances to define a palette with object and the chances to define object in the palette at runtime.I'm starting with GMF in Eclipse but I hv little doubt is it superior to use JUNG2 or something else?

Multiple inheritance in Java?

I good know that it can be done with the help of interfaces and I hv done it various times. But this time my situation is quite difference. I hv class A class B and i require to generate other class C which extends both A and B becoz C should have boths functionality and also note that A and B are not inter related so even i can not say A can extend class B.I am quite confused what should i do right now. I know we can not update java... but at least there would be little approach possible. Even the nea

problem in creating waveform. Can't understand the calculations

I'm trying to make up a waveform for a clip tha i pass it during run-time . I hv taken help from little links like :link 1 and link 2 but i don't understand the calculation segment when little bit shift is done. This is the design of The code snippet that I hv prepared so far . Class SingleWaveformPanel has to be written that will conatin all the calculations.import javax.swing.*;import java.awt.*;import java.util.*;import javax.sound.sampled.*;class WaveformPanelContainer extends JPanel {Array

Empty page when put TabLayoutPanel to SplitLayoutPanel

I hv a GWT code snippet snippet but the solution is blank page. why? public void onModuleLoad() { leftPanelSetup(); rightPanelSetup(); splitPanelSetup();}private void splitPanelSetup() { SplitLayoutPanel layoutPanel = new SplitLayoutPanel(); layoutPanel.addWest(leftTabLayoutPanel 300); layoutPanel.addEast(rightTabLayoutPanel 400); RootPanel.get("content").add(layoutPanel);}private void leftPanelSetup() { // generate a tab panel leftTabLayoutPanel = new TabLayoutPanel(1.5 Style.Unit.EM); /

how to debug an issue when the cause is not known

We are facing the following exception in weblogic server v10.3.2.0. We are using JRockit JRE 6.0. We have around 6-7 XA datasources involved in every server request. We face this exception when processing on the last datasource just begins.Plz someone advise.java.sql.SQLException: Unexpected exception while enlisting XAConnection java.sql.SQLException: Transaction rolled back: setRollbackOnly called on transaction at weblogic.jdbc.jta.DataSource.enlist(DataSource.java:1616) at weblogic.jdbc.jta.Data

Deserialize generic type with XStream

I'm trying to use XStream to deserialize a xml o/p to a class that has a generic type field.For illustration I hv class Responseclass Response{ int id; T field; public int getId(){ return id; } public T getField(){ return field; }}class B extends BaseDTO{}class C extends BaseDTO{}public abstract class XStreamFactory{ public static XStream initXStream(Class c){ XStream xstream = new XStream(new DomDriver()); xstream.alias("response-root" o/p.class); if(c.equals(B.class)){

Apache POI: How to convert HSSFWorkbook to XSSFWorkbook

How do I update org.apache.poi.hssf.usermodel.HSSFWorkbook to org.apache.poi.xssf.usermodel.XSSFWorkbook in Apache POI?Environment: JSE1.6 JBossAS 4.3.2 POI 3.7