找不到符号:同时使用Collection-HashSet

时间:2016-06-23 02:25:58

标签: java

找不到符号:collection-HashSet

我在试图让这个程序工作时遇到一些问题,任何帮助都将不胜感激

<div class=" modal fade" id="win" role="dialog">
    <div class="modal-dialog">

         <!-- Modal content-->
         <div class="modal-content">
             <div class="modal-header">
                 <button type="button" class="close" data-dismiss="modal">&times;</button>
                 <h4 class="cong modal-title">Congratulations <span ng-bind="name"></span>!</h4>
              </div>
              <div class="row">
                  <div class="col-lg-6">
                      <div class="modal-body">

                          <a href="#/Success">
                              <button type="submit" class="btn btn-danger btn-block">NEXT</button>
                          </a>
                      </div>
                  </div>
              </div>
         </div>

         <div class="modal-footer">

         </div>
    </div>
</div>

2 个答案:

答案 0 :(得分:0)

两件事:

  • 导致您遇到错误的第一个是HashSet类的错字。它应该是:

            Utils.logcat(Const.LOGD, encTag, "MediaCodec encoder thread has started");
            isEncoding = true;
            byte[] amrbuffer = new byte[32];
            short[] wavbuffer = new short[160];
            int outputCounter = 0;
    
            //setup the wave audio recorder. since it is released and restarted, it needs to be setup here and not onCreate
            wavRecorder = null; //remove pointer to the old recorder for safety
            wavRecorder = new AudioRecord(MediaRecorder.AudioSource.MIC, SAMPLESWAV, AudioFormat.CHANNEL_IN_MONO, FORMAT, 160);
            wavRecorder.startRecording();
            AmrEncoder.init(0);
    
            while(!micMute)
            {
                int totalRead = 0, dataRead;
                while(totalRead < 160)
                {//although unlikely to be necessary, buffer the mic input
                    dataRead = wavRecorder.read(wavbuffer, totalRead, 160 - totalRead);
                    totalRead = totalRead + dataRead;
                }
                int encodeLength = AmrEncoder.encode(AmrEncoder.Mode.MR122.ordinal(), wavbuffer, amrbuffer);
    
                try
                {
                    Vars.mediaSocket.getOutputStream().write(amrbuffer);
                    Vars.mediaSocket.getOutputStream().flush();
                }
                catch (IOException i)
                {
                    Utils.logcat(Const.LOGE, encTag, "Cannot send amr out the media socket");
                    Utils.dumpException(tag, i);
                }
    
  • 第二个是当你调用HashSet < String> hs= new HashSet< String>(); 的迭代器方法时,它应该是HashSet而不是hs.iterator()(请注意)。

    < / LI>

答案 1 :(得分:0)

Hashset<String> hs= new HashSet<String>();

在上面的行中你需要将Hashset改为HashSet

因为类的实际名称是HashSet而你编写Hashset所以类名不匹配。